The troops from the 1st Armored Division were on a routine patrol when the ambush occurred about 8 p.m. No further details have been made public.
Earlier Thursday, a bomber crashed a white Oldsmobile loaded with explosives into a police station in the Sadr City neighborhood, killing himself and nine other people and wounding as many as 45. Sadr City is the largest Shiite Muslim enclave in the Iraqi capital.
Also Thursday, gunmen - one dressed as a Muslim cleric - shot and killed a Spanish military attache.
The violence, six months to the day after Baghdad fell to American forces, underscored the predicament of a capital whose deliverance from Saddam Hussein's tyranny has been repeatedly undermined by terrorism, attacks on U.S. forces and sectarian unrest.
The ancient city's landscape is now lined with massive concrete blast barriers and coils of barbed wire outside hotels, government departments and along stretches of road near U.S. military bases.
As in previous attacks, there was no claim of responsibility for the 8:30 a.m. bombing in Sadr City, a Baghdad district with an estimated 2 million Shiites.
"It was a huge blast and everything became dark from the debris and sand. I was thrown to the ground," said Mohammed Adnan, who sells watermelons opposite the police station.
Vegetable seller Fakhriya Jarallah said two of her sons were repairing the outside wall of the compound.
"I ran across the road like a madwoman to find out what happened to my sons. But thanks to God they are both safe," she said.
Policemen and some in the crowd that gathered outside the police station after the explosion offered an assortment of possible culprits ranging from non-Iraqi Arab militants to Saddam loyalists and Shiite radicals angry about a cleric's arrest.
The killing of the Spanish military attache happened across town in the upscale Mansour area about 30 minutes before the car bombing.
Jose Antonio Bernal Gomez, an air force sergeant attached to Spain's National Intelligence Center, was shot to death after four men, one dressed as a Muslim cleric, knocked on the door of his home, according to a Spanish diplomat in Baghdad who spoke on condition of anonymity.
A guard in the area, also speaking on condition of anonymity, said Gomez opened the door to the gunmen. When they tried to grab him, he ran outside and was shot. The guard said he heard six shots and Gomez was hit in the head at least once.
American, Iraqi and Spanish authorities are investigating the attack.
Commenting on Thursday's violence, L. Paul Bremer, the top U.S. official in Iraq, emphasized the U.S. commitment to fighting terrorism, branding the perpetrators of attacks in Iraq as individuals who have shown "wanton disregard" for the lives of innocent people.
In other recent developments:
Bremer said Thursday he welcomed the White House's decision for a new coordinating committee for Iraq. Bremer reports to the Defense Department, but it was disclosed earlier this week the White House had set up an oversight committee for Iraq operations.
In Sadr City, some 50 policemen had gathered in the police station's courtyard to collect their pay when the white Oldsmobile sped up. Two policemen on guard duty at the gate opened fire, but the car went through, crashed into a parked vehicle and exploded.
"I ran and got hit in the leg. When I looked back, all I could see was fire," officer Khalid Sattar Jabar said from his hospital bed. He said he got a look at the driver: a man with a beard and a thick head of hair.
Mangled police cars were scattered around the bomb site, and debris filled the large courtyard in front of the one-story police building. The blast left a crater about 10 feet across and 4 feet deep, said a U.S. Army officer at the scene.
Three policemen and five civilians were killed, said Capt. Sean Kirley of the 2nd Armored Cavalry Regiment. In addition, the two people in the car died, said Iraqi police Capt. Bassem Sami.
Hospitals reported treating 45 wounded.
The blast attracted a crowd of up to about 2,000 people. The crowd became angry when scores of American soldiers in Humvees arrived and put a security ring around the area. There was panic later when two men ran in shouting that another car bomb was about to go off; it was a false alarm.
Still later, the crowd became agitated when a rumor spread that American soldiers were surrounding the nearby office of Muqtada al-Sadr, a Shiite cleric who opposes the U.S. occupation. He was not at the office, and his Baghdad representative, Sheik Qais al-Khaza'ali, said soldiers had wanted to search the office but left without doing so.
Hundreds of al-Sadr supporters, armed with assault rifles and rocket-propelled grenades, guarded the office in the afternoon, sealing off streets leading to it and taking positions on rooftops.
The mainly Shiite area was known as Saddam City until Saddam's ouster, when it was renamed for al-Sadr's father, a Shiite cleric killed in 1999 by suspected security agents.
The area has been tense for days, with supporters of the younger al-Sadr demanding that the U.S.-appointed local council be replaced by one they say was democratically elected in polls they organized.
An Iraqi policeman who pushed through the crowd was stabbed in the arm after being set upon by the mob, which chanted "No, no to America!" He was treated by U.S. military medics at the scene.
The crowd also attacked Associated Press Television News camera crews and stole some equipment. One crew member was slightly injured. Scores of other journalists, including Iraqis, were jostled by the crowd.
Opinions differed about who might have been behind the bombing.
Saad Drawal al-Dharaji, a wounded police sergeant, said an imam had threatened to take action against the police station unless it turned over some policemen for "punishment" for having served under Saddam.
"We will have our revenge for this," al-Dharaji said. He didn't know the name of the cleric.
Wounded officer Jabar said another possible motive for the attack was the detention of Shiite cleric Moayed al-Khazraji, who was arrested by American forces Monday.
The cleric's supporters rallied at the police station Wednesday to demand his release, but dispersed peacefully. Iraqi police said the cleric is not in their custody.