The attack represented a major challenge to US efforts to bring together Shia and Sunnis in Diyala province, scene of some of the most severe fighting in Iraq.
About two hours after the blast, US soldiers at nearby Camp Warhorse fired artillery rounds at suspected fighter positions near Baquba.
There were no reports of damage or casualties.
Witnesses and officials said the bomber struck when most of the victims were in the mosque courtyard washing their hands or drinking tea during Iftar, the daily meal in which Muslims break their sunrise-to-sunset fast during Ramadan.
Security guards approached a man after noticing him walking rapidly through the courtyard.
As the guards challenged him, the man detonated an explosive belt, setting off the blast, police Major Salah al-Jurani said.
Al-Jurani said he believed provincial Raad Rashid al-Tamimi, the governor, was the intended target.
The governor was wounded and his driver was killed, al-Jurani said.
The dead also included Baquba’s police chief, Brigadier-General Ali Dalyan, and the Diyala provincial operations chief, Brigadier-General Najib al-Taie, according to security officials.
Also wounded was the governor’s brother, Sheikh Mazin Rashid al-Tamimi, who has spearheaded Sunni-Shia reconciliation efforts in the province.
“We’ve tried to persuade the tribes to oust terrorists from their areas because it’s a disaster when the tribes co-operate with and provide refuge to al-Qaeda,” Sheikh Mazin told The Associated Press last weekend.
US officials have accelerated efforts to reconcile Sunni and Shia tribes in Diyala after American soldiers last summer gained control of Baquba, the provincial capital and al-Qaeda’s declared capital of its Islamic State of Iraq.
The US announced this month that senior leaders of 19 of the 25 major tribes in Diyala – 13 Sunni and six Shia – had agreed to end sectarian violence and support the government, although the province remains one of the most dangerous in the country with frequent kidnappings and armed clashes.
The effort is loosely modelled on an alliance of Sunni tribes which banded together last year to fight al-Qaeda in al-Anbar province.
The leader of that effort, Sheikh Abdul-Sattar Abu Risha, was killed in a bombing on September 13.