Iraqi forces have pushed IS out of much of the territory it once held, but this bombing and the many others that have preceded it highlight the danger the militants can pose to civilians even as they lose ground.
“A soldier at the gate of Jamila market opened fire on a suicide car bomb after noticing a suspect vehicle but the terrorist blew up his car,” interior ministry spokesman Saad Maan said.
A police colonel and a hospital official said at least 12 people were killed and 39 wounded. Maan said the soldier who opened fire on the attacker was among the wounded.
Jamila is the main wholesale vegetable market in Baghdad and lies in Sadr City, a vast, mostly Shiite neighbourhood in the northeast of the capital which has been repeatedly targeted.
IS issued an online statement claiming the attack.
IS claimed an attack on January 2 — also in Sadr City — when a suicide bomber blew up a vehicle packed with explosives among a crowd of day labourers waiting for work, killing 35 people.