A series of bombings across Baghdad were the deadliest in a spate of nationwide attacks that killed 47 people on Tuesday, as Iraq struggles with its worst violence since 2008.

At least eight car bombs and several roadside bombs struck the capital just before Iraqis broke their daytime Ramadan fast, the latest in brutal violence during the Muslim holy month that has left hundreds dead.

The blasts came barely two weeks after militants staged audacious raids on two prisons near Baghdad, freeing hundreds of inmates, including convicted jihadists -- an operation claimed by an Al-Qaeda front group.

In Baghdad, bombings hit a variety of targets including shops and a market, in mainly Sunni and mainly Shiite districts as well as confessionally mixed neighbourhoods, from around 5:30 pm (1430 GMT).

In all, 31 people were killed and 120 wounded, security and medical officials said.

In the central commercial district of Karrada, a car bomb killed five people and badly damaged store fronts and a nearby vehicle, an AFP correspondent reported.

Ten other people were killed by a late night car bomb that ripped through a packed commercial street just north of Baquba, the capital of restive Diyala province, officials said.

Prime Minister Nuri al-Maliki vowed to continue operations against the militants, in a statement issued just before the attacks began.

"We will not leave our children to these murderers and those standing behind them and supporting both inside and outside," Maliki said.

"Iraq and Iraqis will not be victims of takfiri fatwas," he said, referring to religious rulings issued by extremists.

Violence has risen sharply in recent months, with almost 1,000 people killed in July, according to official figures, the worst violence since Iraq was emerging from a brutal sectarian war in 2008.

The attacks have mostly hit north of Baghdad, but the capital has not been spared.

More than 10 car bombs struck the Iraqi capital on July 29, killing at least 45 people, in a series of attacks claimed by Al-Qaeda front group the Islamic State of Iraq and the Levant.

Elsewhere in Iraq on Tuesday, six people were killed.

Gunmen stormed the home of a policeman's sister to the south of the northern city of Mosul, took him outside, and executed him.

Shootings and bombings in Fallujah and Khanaqin, west and northeast of Baghdad respectively, left three others dead.

In Diyala, north of the capital, security forces killed two militants driving explosives-laden vehicles.

The attacks came just weeks after brazen attacks on prisons in Abu Ghraib and Taji in which hundreds were freed.

Analysts, as well as global police organisation Interpol, have warned that the jailbreaks could lead to a rise in attacks as many of those who broke out were linked to the Islamic State of Iraq and the Levant.

Security forces have meanwhile launched major operations, among the biggest since the December 2011 withdrawal of US forces, targeting militants in multiple provinces including Baghdad.

Violence has been increasing since the beginning of the year, especially after an April 23 security operation at a Sunni Arab anti-government protest site that sparked clashes in which dozens died.

Protests erupted in Sunni-majority areas in late 2012, amid widespread discontent among Sunnis, who accuse the Shiite-led government of marginalising and targeting their community.

Analysts say Sunni anger is the main cause of the spike in violence this year.

In addition to security problems, the government in Baghdad is also failing to provide adequate basic services such as electricity and clean water, and corruption is widespread.

Political squabbling has paralysed the government, which has passed almost no major legislation in years.