Police officials said the attackers entered the building in Baghdad's southeastern neighborhood of New Baghdad and shot at Sunni worshippers who were performing today's dawn prayers.
Police said the gunmen used weapons fitted with silencers. They said two other worshippers were wounded.
Medics in a nearby hospital confirmed the casualty figures. All officials spoke on condition of anonymity because they were not authorized to talk to the media.
Most attacks on civilians in recent years have been the work of Sunni extremist groups such as al-Qaida. But attacks on Sunni mosques have been on the rise in recent months, raising fears that Shiite armed groups are starting to retaliate.