A suicide bomber targeted a funeral on Saturday in a mostly Shiite neighbourhood of northern Baghdad, killing at least 34 people and injuring more than 35, al-Sumaria television reported.
The Islamic State claimed the attack, the radical Sunni extremist group's Amaq news agency said.
The blast in the Shaab area of the Iraqi capital struck a funeral that was being held during wider Shiite religious events to mark Ashura, a commemoration of the death of Hussein, the grandson of the prophet Mohammad.
Ashura, which fell this week, is especially holy to Shiites who revere Hussein.
The attack hit as Iraqi security forces, backed by Shiite militias and the US-led coalition, gear up to recapture Mosul, a northern city that has been held by Islamic State since 2014.
Shiites in Baghdad and other areas have often been targeted by Sunni extremists, including Islamic State fighters.
Islamic State is on the back foot after losing vast territory across Iraq to local forces backed by US airstrikes.
In Syria too, the group is under immense pressure and is on the verge of losing Dabiq, a symbolic village near the border with Turkey.