The attack came hours after reports that 17 bodies had been found bound and killed execution-style in the same restive province, Anbar.
In Baghdad, at least three Iraqis were killed and several wounded in a car bomb attack near a busy marketplace in the mainly Shia district of Shula.
In Kirkuk and Basra, police colonels were killed in drive-by shootings.
"Five marines were killed in action Thursday when their vehicle hit an explosive device while conducting combat operations near Haqlaniyah," the US military said in a statement.
Further west, close to the Syrian border, 17 bodies were found in two separate groups near the desert town of Qaim.
Officials said 22 Iraqi soldiers were kidnapped in the area on Wednesday but it was not clear if the bodies were of some of the troops.
Eleven of the bodies had been dumped in a gravel pit.
Witnesses, including an Associated Press reporter, said the victims had their hands tied behind their backs and were wearing civilian clothes.
Website claim
The discovery came a day after six bodies were found nearby, also in civilian clothes. Some of them had been beheaded, witnesses said.
The group of soldiers went missing on Wednesday after leaving their Qaim base to go to Baghdad on leave. They had been wearing civilian clothes, police said.
Al-Qaeda in Iraq, the group led by Iraq's most-wanted militant, Abu-Musab al-Zarqawi, said on a website it had captured 36 Iraqi soldiers, or "infidel guards", in western Iraq on Wednesday.
The blast in Baghdad happened near a busy marketplace at 2200 (1800 GMT), an hour before a night-time curfew came into the effect, an interior ministry source told the AFP news agency.
At least 15 people were wounded, the AFP reported.
Police in the northern city of Kirkuk said Colonel Rahim Uthman, head of the local anti-terrorist department, had been killed on Thursday.
He and his assistant Major Ghanim Jihad were shot dead from a blue BMW, they said.
And on Friday in the southern city of Basra, the commander of the local police academy was shot dead.
Three or four gunmen in a car swerved in front of Colonel Abdelkarim Daraji's vehicle and opened fire, police said. His brother also died in the attack.
US Marine Corps Seal


In a statement issued Friday evening, United States Marine officials said five Marines had been killed in a roadside blast in Western Iraq.

The Marines were killed as a result of an explosion while conducting combat operations with 2nd Marine Division, Expeditionary Force, in Haqlaniyah, Iraq.

The attack itself came hours after reports that up to 17 bodies had been found in the same province. Reports say that the bodies were killed "execution style" and were near Anbar.

In Baghdad, up to three Iraqi civilians were killed and several others were wounded in a car bomb blast, that exploded near a busy marketplace in the mainly Shia district of Shula.

Department of Defense officials identified the Marines to be Lance Cpl. Dustin V. Birch, 22, of Saint Anthony, Idaho; Lance Cpl. Daniel Chavez, 20, of Seattle, Wash; Lance Cpl. Thomas O. Keeling, 23, of Strongsville, Ohio; Lance Cpl. Devon P. Seymour, 21, of St. Louisville, Ohio;
and Cpl. Brad D. Squires, 26, of Middleburg Heights, Ohio.