Many children were returning to school for the first time after the Muslim festival of Eid al-Adha.
Twenty-five children were among the wounded, two hospital officials said.
The officials spoke on condition of anonymity because they were not authorised to release the information.
The blast partially toppled a brick wall in front of the school, leaving a crater that quickly filled with muddy water, apparently from a broken water line.
The attack comes a day after the Iraqi parliament passed a new electoral law paving a way for the general elections in February.
Iraqi and US military officials have expressed concern about a possible spurt in attacks aimed at destabilising the government before next year's elections.
On Monday, gunmen stormed a checkpoint near Tarmiyah, north of Baghdad, killing five members of an anti-al-Qaeda group, police said.
The men were members of the Sunni Awakening Council, one of many Sunni groups that have begun taking on al-Qaeda in Iraq.
There are an estimated 2.5 million Shia living in Sadr City, a stronghold of Shia leader, Muqtada al-Sadr, known for his anti-US stance.