Earlier conflicting reports said a rocket had struck the side of the town's general hospital.
And Mahmudiya's mayor told the Reuters news agency a truck bomb was the cause of the explosion.
More than 30 people are thought to have been injured in the attack, with the death toll likely to rise in the coming hours.
Mahmudiya's residents are an even mix of Sunni and Shia Muslims, and the town has repeatedly been used as a staging ground for sectarian attacks.
Elsewhere in Iraq, four people were killed in the south-west Baghdad suburb of Ilam following a car bomb, while the US army has confirmed that four of its soldiers died yesterday in the north-eastern Diyala province after a roadside bomb was detonated near their vehicle.
Click here to run an energy price comparison, and see if you could be paying less for your gas and electricity.