The assailants struck in the centre of the Iraqi capital during the Muslim holy month of Ramadan, when many people stay up past midnight and eat out to prepare for the next day's fast.
Two car bombs killed at least 31 people in Baghdad and wounded over 60 others in streets packed with crowds preparing for the Ramadan fast early on Tuesday, Iraqi security sources said.
Daesh claimed responsibility for the first blast outside an ice cream parlour that killed 17 people and wounded 32 according to police. It happened just after midnight (21:00 GMT on Monday) in the Iraqi capital's commercial Karrada district.
A few hours later, a second attack killed 14 people and wounded 32 according to police. It was near a government office in Karkh district. There was no immediate claim of responsibility for the second attack, although authorities said it bore the hallmarks of Daesh.
The Karrada district was hit by a massive truck bomb in July 2016 that killed at least 324 people. It was the deadliest attack in Iraq since the US-led invasion of the country in 2003.
Daesh has been retreating in Iraq since the end of 2015 in the face of US-backed government forces and Iran-backed Shia paramilitary groups.
The terrorist group is now besieged in an enclave in the northern city of Mosul, which it has used as its de facto capital in Iraq since declaring its so-called 'Caliphate' in June 2014.