The attacks that killed the American soldiers occurred between 3.30pm and 3.45pm local time (1230 GMT and 1245 GMT), the US spokeswoman said, asking not to be named.
"In the attack on the Green Zone, two rockets killed two US service personnel and wounded between 17 and 19," she said.
"At about the same time a rocket attack on a forward operating base in the Rustumiya area (eastern Baghdad) killed another serviceman."
US commanders say barrages of rockets and mortars are being fired daily from Sadr City.
The US fatalities came on a day marked by deadly clashes in Baghdad, which erupted just hours after the Iraqi government relaxed security measures around Sadr City and another Mahdi Army stronghold, Shula.
Officials at two local hospitals said women and children were among the dead.
An Iraqi police officer said sporadic exchanges of fire occurred throughout Sunday morning.
He said two armoured Humvee vehicles belonging to the Iraqi army were hit and a US Stryker armoured personnel carrier damaged.
The US military did not confirm the Stryker-damage claim, but said that fighting had broken out overnight between fighters and Iraqi security units supported by US forces.
US forces carried out an air strike in Sadr City that killed "nine criminals", a US military statement said.
Nasser al-Rubaei, the head of al-Sadr's bloc in Iraq's parliament, told of "joint Iraqi and US attacks against Sadr City".
In an effort to ease conditions for Sadr City's 2.5 million residents, the government has allowed lorries carrying maintenance teams, food, oil products and ambulances into the area.
A vehicle ban remains in effect as part of a curfew imposed on Baghdad after fighting broke out between government forces and Mahdi Army fighters on March 25.
The curfew has been lifted in the rest of Baghdad.
|Amid clashes in Baghdad, al-Sadr's bloc faces|
growing pressure to disarm its militia [GETTY]
Al-Sadr has called for a protest on April 9 in Sadr City against the presence of US forces in Iraq.
His office said it expects at least one million people to turn out for the protest.
Sunday's clashes in Baghdad formed a violent backdrop to political efforts to isolate the Mahdi Army.
All the major Shia, Sunni and Kurdish parties have closed ranks to pressure al-Sadr into disbanding the Mahdi Army or be barred from political life, according to legislators and officials involved in the effort.
They said a first step would be to add language to a draft election bill banning parties that operate militias from fielding candidates in provincial balloting this autumn.
Al-Sadr controls 30 of the 275 parliament seats, a substantial figure but not enough to block legislation.
In northern Iraq, meanwhile, Iraq's security forces freed 42 university students who had been kidnapped by armed men on Sunday, a local army commander said.
Brigadier-General Khalif Abdul-Sattar said the students were waylaid about 30km south of Mosul on the main highway to Baghdad.
Three other students on a second bus were injured when armed men opened fire as the driver managed to speed away, he said.
It was not immediately clear where the students were coming from or where they were going.