The bloodshed comes just weeks before Iraq is due to hold its first general election since 2010, although the poll was thrown into disarray on Tuesday when the entire electoral commission resigned in protest at alleged political interference.
The surge of unrest has been driven by anger among the Sunni Arab minority, who complain of mistreatment by the Shiite-led government and security forces, as well as by the civil war in neighbouring Syria.
In Tarmiyah, a mainly Sunni Arab town 45 kilometres (30 miles) from Baghdad that is frequently hit by deadly violence, militants opened fire on an army patrol, killing eight people, including seven soldiers, security and medical officials said.
Another 14 people were wounded, 10 of them soldiers.
More From This Section
In confessionally mixed Taji, also north of the capital, a car bomb targeting another army patrol killed four soldiers and wounded 11 others.
In Baghdad itself, separate vehicles rigged with explosives killed 11 people.
Attacks elsewhere in the country, all in predominantly Sunni areas, killed 14 people.