The force of the blast brought down several buildings in Khan Bani Saad, about 30 kilometres northeast of Baghdad, crushing to death people who were celebrating the end of the Muslim fasting month of Ramadan, police and medics said.
The Islamic State group has claimed responsibility for the attacks, according to messages posted on Twitter. The claim could not be independently verified but it was posted by accounts commonly associated with the group.
Parts of Diyala were captured by the Islamic State group last year. Iraqi forces and Kurdish fighters have since retaken those areas, but clashes between the militants and security forces continue.
The Sunni militant group has been behind several similar large-scale attacks on civilians or military checkpoints as it seeks to expand its territory, which includes a third of Iraq and Syria.