A suicide bomber detonated his explosives inside the cafe in the west of the city, police said.
No group has said it carried out the attack.
The violence comes ahead of Iraq's provincial elections on 20 April, the first in the country since 2010.
Emergency workers were still trying to pull out victims trapped in the rubble when part of the building collapsed, police told the Reuters news agency.
On Monday, a series of co-ordinated car bomb attacks took place across the country, claiming at least 31 lives and injuring more than 200 people.
Tensions are high between Iraq's Sunni and Shia, amid claims by the Sunni Muslim communities that they are being marginalised by Prime Minister Nouri al-Maliki's Shia-led government.
Sunni Islamist militants linked to al-Qaeda have attempted to destabilise the government by stepping up attacks, mainly on Shia but also Sunni targets this year.
Although violence has decreased in Iraq since the peak of the insurgency in 2006 and 2007, bombings are still common.
At least 27 people, including two children, have been killed and dozens more injured in a bomb attack on a cafe in the Iraqi capital Baghdad, officials have said.