The head of the emergency room at the hospital said 31 people were killed and 28 wounded in the blast. Police sources put the death toll at 30 with around two dozen wounded. It was not clear if it was a suicide car bomb attack.
The bombing is the latest in an apparently stepped-up campaign of militant violence over the past week and in the run-up to parliamentary elections set for Dec. 15.
Since last Friday, nearly 200 people have been killed in a series of suicide bombings and car bomb blasts, including 77 killed when bombers strapped with explosives blew themselves up inside two Shi’ite mosques in the northern town of Khanaqin.
Many of the attacks have born a sectarian element, with Sunni Arab insurgents targeting Shi’ite Muslim communities.
Mahmoudiya is in a violent region south of Baghdad dubbed the Triangle of Death for the high number of attacks.
It is part of a belt of mixed Sunni and Shi’ite towns where sectarian tensions have spilled over into violence, leading to fears Iraq could be sliding towards a full-blown civil war.
Earlier, Iraq’s Defence Ministry said soldiers had found a car west of Baghdad that was filled with booby-trapped children’s toys packed with hand-grenades and explosives.
A government spokesman said two people had been detained.