You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The shooting occurred at Camp Liberty, a sprawling US base on the western edge of Baghdad near the city's international airport and adjacent to another facility where President Barack Obama visited last month.
A brief US statement said the soldier "suspected of being involved with the shooting" was in custody but gave no further details. It was unclear what provoked the attack.
"Anytime we lose one of our own, it affects us all," US spokesman Col. John Robinson said. "Our hearts go out to the families and friends of all the service members involved in this terrible tragedy."
Separately, the military announced Monday that a US soldier was also killed a day earlier when a roadside bomb exploded near his vehicle in Basra province of southern Baghdad.
The death toll from the Monday shooting was the highest for US personnel in a single attack since April 10, when a suicide truck driver killed five American soldiers with a blast near a police headquarters in Mosul.
Attacks on officers and sergeants, known as fraggings, were not uncommon during the Vietnam war as morale in the ranks sank. However, such attacks are believed to be rare in the wars in Iraq and Afghanistan.
In 2003, Army Sgt. Hasan Akbar was sentenced to death for killing two officers in Kuwait just before the US-led invasion of Iraq of 2003.
In June 2005, an Army captain and lieutenant were killed when an anti-personnel mine detonated in the window of their room at the US base in Tikrit. A National Guard sergeant was acquitted in the blast.
Additionally, there have been several incidents recently when gunmen dressed as Iraqi soldiers have opened fire on American troops, including an attack in the northern city of Mosul on May 2 in which two soldiers and the gunman were killed.
Also Monday, a senior Iraqi traffic officer was assassinated on his way to work in Baghdad. It was the second attack on a high-ranking traffic police officer in the capital in as many days.
A car cut off Brig. Gen. Abdul-Hussein al-Kadhoumi as he drove through a central square in the capital and a second vehicle pulled up alongside and riddled him with bullets, police said, citing witnesses. Al-Kadhoumi was director of operations for the traffic authority.
The gunmen were armed with pistols equipped with silencers, the police added on condition of anonymity because they were not authorized to speak to the media.
Incidents involving gunmen armed with sophisticated weapons, including silencers, have been on the rise since a string of high-profile robberies in April.