The suspect is in custody after the shooting at sprawling Camp Liberty, military officials say.
The suspect is now in custody and an investigation underway, a military statement said.
It said the incident occurred about 2 p.m. at Camp Liberty, part of a sprawling complex of bases adjoining the Baghdad International Airport that house tens of thousands of troops.
"Any time we lose one of our own, it affects us all," said Col. John Robinson, spokesman for the Multi-National Corps in Iraq. "Our hearts go out to the families and friends of all the service members involved in this terrible tragedy."
There have been several instances in recent months in which Iraqi army soldiers have killed Americans on military bases, but no Iraqi troops are located at Camp Liberty.
There have also been sporadic instances of U.S. soldiers shooting fellow soldiers, usually in accidents, but this appears to be the bloodiest such case since the war began.
Also today, the military reported the death of a U.S. soldier on Sunday in a roadside bombing in the southern city of Basra. It was the first American fatality in Basra since U.S. troops took over responsibility for the oil-rich area from British forces at the end of March.
British troops, who had controlled Basra since the start of the war, left on May 1.