Separately, three US soldiers were killed southwest of Baghdad when a roadside bomb hit their patrol, and in the northern city of Tikrit a suicide bomber blew himself up at a funeral wake killing 15 mourners.
An Iraqi defence official said the American and Iraqi army raided Sadr City to arrest a number of Sadr militiamen. They arrived near a house, and militiamen opened fire on them. They exchanged fire and became embroiled in fighting for two hours.
"As a result two militiamen were killed, three other wounded. Two Iraqi soldiers were wounded," he said.
Staff at the Imam Ali hospital said three civilians were killed, including a woman and a three-year-old girl and 18 wounded.
An AFP journalist in Sadr City reported that the raid on the area, a stronghold of a firebrand cleric, was accompanied by air strikes.
The head of Sadr's office in Sadr City, Abdulzahra Al-Suwaidi, claimed that the raid had targeted Mehdi Army supporters to punish them for holding an anti-American and anti-Israeli street rally.
But according to a statement from the US-led coalition, the operation was aimed at "individuals involved in punishment and torture cell activities".
Sadr's militiamen are widely alleged to have taken part in a wave of sectarian and political murders across Baghdad in recent months, although coalition and Iraqi officials are careful never to accuse it publicly.
US generals have made winning back Baghdad for the Iraqi government their priority, after violence split the city on sectarian lines and a vicious war between rival Sunni and Shiite death squads left thousands dead.
Meanwhile the US military also announced on the deaths of three soldiers in a separate incident southwest of the city.
The deaths were the first US casualties in Baghdad since reinforcements began arriving on Saturday to quell the raging sectarian violence that has engulfed Baghdad despite a massive security crackdown since June.
About 3,700 troops of the 172nd Stryker Brigade Combat Team, equipped with 17-tonne "Stryker" armoured vehicles, are taking positions in some of the most violent districts of the capital.
In other violence at least 15 people including a provincial council member were killed when a suicide bomber blew himself up in the midst of mourners in Tikrit, hometown of Iraq's ousted leader Saddam Hussein.
At least 30 others were wounded in the attack.
