The battle was part of a day of violence in the mostly Sunni Muslim city located 60 miles north of Baghdad.
The insurgents launched 38 mortar rounds, hitting the headquarters and collapsing a building used by the Iraqi National Guard and the 1st Infantry Division, according to the Associated Press.
Some of the mortar rounds landed in civilian areas, killing three civilians, medical officials said, and injuring at least 18 U.S. soldiers and four Iraqi guardsmen.
U.S. soldiers responded by firing four mortar rounds and launching a helicopter attack that killed four insurgents, said Maj. Neal O'Brien, spokesman for the 1st Infantry Division, the AP reported.
The deaths in Samarra bring to 651 the total number of U.S. combat deaths in Iraq since the start of the war in March 2003.
Earlier in the day, a U.S. military convoy in Samarra was targeted by a roadside bomb that wounded a U.S. soldier, O'Brien said.
In Baghdad, a former Baath party official was killed when a bomb hidden in his car exploded outside the rope factory that he owned, according to Reuters.
Police refused to speculate on the motive for the attack but said the victim, Ali Abbas Hassan, had been treasurer of a regional committee of ousted dictator Saddam Hussein's Baath party.
Also Thursday, Filipino President Gloria Macapagal Arroyo ordered Filipino contract workers not to travel to Iraq after militants released a video threatening to kill a Filipino hostage if the country did not withdraw its troops.
In the video, broadcast by Al-Jazeera, three armed and masked men calling themselves the Iraqi Islamic Army-Khaled bin al-Waleed Corps stood behind the seated hostage. The group did not give details of his capture.
Arroyo did not make an immediate decision about withdrawing Filipino troops within three days, as the militants demanded.
The Philippines has only 51 troops in Iraq, making up a small percentage of the multinational force, but has more than 4,000 contractors working for the U.S. military, forming the backbone of the support staff for U.S. troops.