The blast, which hit the Sadr City area at around 10 am, also wounded 54 people, the officials said.
There was no immediate claim of responsibility for the attack, but the Islamic State group often carries out bombings in Baghdad and elsewhere, especially targeting Shiite Muslims, whom it consider heretics.
Iraqi forces have regained significant ground from IS, which overran swathes of territory north and west of Baghdad in 2014.
But the jihadists still control a large part of western Iraq, and are able to carry out frequent bombings in government-held areas.