Fifteen people were also wounded in the attack on Al-Zahraa mosque in Baladruz, a district in Diyala province 75 kilometres (46 miles) northeast of Baghdad, the interior ministry said.
There were conflicting reports on the nature of the attack.
The interior ministry said two car bombs went off and a police officer told AFP one car exploded and immediately afterwards a suicide bomber blew himself up.
Read: Islamic State expelled from Iraq town Al Baghdadi: US
IS, in an online claim posted on their website, said a suicide bomber in a car carried out the attack.
"Brother Abu Jihad al-Ansari... drove his booby-trapped car... and blew it up, killing dozens," the statement said.
The interior ministry identified one victim of the "twin terrorist attack" as Colonel Adnan al-Tamimi, who led a rapid intervention force in Baladruz.
Read: Al Qaeda front group claims Iraq attacks
Friday's attack is the latest in a series of IS bombings targeting Shia districts or militias in Iraq, since members of the community have joined ranks with government forces to battle the group.
The extremist group, which controls chunks of Iraq and neighbouring Syria, was present in many areas of Diyala province, which authorities said they retook in January.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ