A bomb exploded during prayers at a mosque in Nigeria, killing five people in what police described as a likely suicide attack.