A minimum of 12 mortar rounds rained down soon after a bomb attached to a bicycle ripped through the market at about 1430 GMT on Saturday.
Three dead and 40 of the most seriously injured were taken to a hospital in Yarmouk in Baghdad's western suburbs, about 30km north of the city.
Hayder Satar, a lieutenant in the Mahmoudiyah police, said 18 people were confirmed dead, but that that number was likely to rise given the nature of some of the injuries.
He said 52 people had been wounded in the attack in total.
Mahmoudiyah, a primarily Shia city surrounded by Sunni communities, was the scene in July of one of the worst assaults on civilians in recent months when suspected Sunni gunmen sprayed grenades and automatic weapons fire in a market, killing at least 50 people, mostly Shias.
Four people were killed when a bomber blew himself up outside Baghdad's Baratha mosque, one of the city's most important Shia sites and a frequent target of attacks.
The bomber was driving a minibus when it exploded near the mosque on Saturday, also wounding 15 people.
The blast came after a quiet day in the capital on Friday that saw no news of high-profile attacks, although armed Shia groups did engage in bloody clashes in the south of the country.
The Baratha mosque was targeted in April by bombers dressed as women who killed 90 people, and again in June by another explosion that killed 11.
In further attacks in the capital, a blast on a minibus killed four people and wounded 15 as it was crossing a bridge into the western Al Karkh district of the city.
Meanwhile three separate car bombs hit Baghdad.
A bomb in the centre targeting a police patrol killed one civilian and wounded three.
In northern Baghdad a bomb on Cairo Street wounded four people and a blast in the southern Amel district of Baghdad wounded two people.
Ali Naamah, an Iraqi police lieutenant, said violence erupted in Suwayra, a town on the Tigrissome 45km south of Bagdad, after some 150 Mahdi Army fighters, loyal to Shia cleric Moqtada al-Sadr, attacked police.
He said eight gunmen died and two civilians were wounded.
A Sadr spokesman said the attack on the police station was a response to a raid by US troops backed by helicopters on a Sadr office that killed six people.
Hamid al-Zargani said Mahdi Army fighters withdrew from positions after receiving a message from Sadr calling for calm.
The U.S. military said it had no reports of helicopter attacks.
In a separate development, police in Hilla said they intervened to halt a clash between rival Shia groups after the Mahdi Army was accused of planting a bomb by an office of the Supreme Council for the Islamic Revolution in Iraq (Sciri).
Police said one Sciri guard was injured in the blast. Hilla is a mainly Shia town south of Baghdad.
In Ramadi, 110km west of Baghdad, the US military said troops killed a senior al-Qaeda leader in Iraq leader, and seven more suspects were detained.
The military said the dead man, whom they did not identify, was believed to be "responsible for coordinating access to weapons and finances for foreign fighters and for media production and propaganda distribution for al-Qaeda in Iraq".
In Kirkuk, 250km north of Baghdad, one policeman was killed when gunmen opened fire on his vehicle.
Two Iraqi soldiers were killed and one wounded in Al Hawija, 60km southwest of Kirkuk, when gunmen opened fire on their vehicle.
George W Bush, the US president, has spoken to US military commanders about the progress of the Iraq war and said he would "make every necessary change" in tactics to try to control spiraling violence there.
Despite growing election-year pressure from both Republican and Democratic politicians for an overhaul of his Iraq strategy, Bush insisted he would not abandon his goal of building a self-sustaining Iraq government.
The president, however, acknowledged in his weekly radio address that the violence there has risen sharply. In October alone, at least 80 US troops have been killed, a pace that, if it continues, could make it one of the deadliest months for US forces since the war began in 2003.
Bush said: "Our goal in Iraq is clear and unchanging, our goal is victory. What is changing are the tactics we use to achieve that goal."
Bush held a videoconference involving Dick Cheney, the vice president, Donald Rumsfeld, the defence secretary, top White House officials and US military officials in Iraq.
Nicole Guillemard, a White House spokeswoman, said: "This meeting was the third in a series of consultations between the president and his commanders in the field on Iraq.
"The participants focused on the nature of the enemy, the challenges in Iraq, how to better pursue our strategy, and the stakes of succeeding for the region and the security of the American people."