The raid was carried out as Iraqi and US soldiers were searching for members of a network that American commanders accuse of bringing weapons and explosives in from Iran, and sending fighters from Iraq to Iran for training.
The US military said: "During the course of the operation, the assault force and the overhead aerial support observed a vehicle and large group of armed men on foot attempting an assault on the ground forces.
"Responding appropriately to the threat of the organised terrorist force, close air support was called and engaged the terrorist vehicle and organised terrorist force, killing an estimated 30 terrorists."
Earlier, on Tuesday, the US military announced the deaths of four more US soldiers in Iraq, raising the US death toll for the first six days of the month to 21.
A British serviceman has also been killed in southern Iraq, the ministry of defence said on Wednesday.
Thousands of pilgrims gathered in Baghdad, taking to the streets under heavy security in an annual religious gathering.
The government had banned all traffic from dawn to guard against car bombings that routinely target Shia crowds, particularly at religious events.
Brigadier-General Qassim Atta said: "The leadership of the Baghdad security plan decided to impose the vehicle curfew from Wednesday morning, instead of the evening (as previously announced) until Saturday morning."