A US Marine who led the unit accused of killing 24 Iraqi civilians in Haditha shot five men as they stood with their hands in the air, another marine said.
The US marines say they came under fire after a roadside bombing
Staff Sgt Frank Wuterich then told his comrades to lie about it and blame the Iraqi army, a court heard on Wednesday.
Sgt Sanick Dela Cruz was speaking at a hearing for one of the four officers charged with dereliction of duty for not investigating the killings.
Three other marines have been charged with second-degree murder.
Iraqi witnesses say the shootings were in retaliation for a roadside bomb that had killed Lance Cpl Miguel Terrazas as his convoy drove through Haditha, 240km (150 miles) north-west of Baghdad, on 19 November 2005.
Sgt Dela Cruz also told the military courtroom at Camp Pendleton in California that he urinated on the body of an Iraqi civilian.
He told the court of the distress he felt after discovering the explosion had ripped Lance Cpl Terrazas, known as TJ, in half.
"I know it was a bad thing what I've done, but I done it because I was angry TJ was dead and I pissed on one Iraqi's head," he said.
He also testified that after the explosion Staff Sgt Frank Wuterich had shot dead five men as they stood by a white car with the hands in the air.
"They were just standing, looking around, had hands up," he said.
"Then I saw one of them drop in the middle."
"Looked to my left, saw Sgt Wuterich shooting."
Afterwards Sgt Dela Cruz said he himself had "sprayed" the bodies with gunfire.
"I knew they were dead, I wanted to make sure," he explained.
Sgt Wuterich then shot each of the men in the upper body and head, Sgt Dela Cruz testified.
"He went to every single one of them, sir, and shot them," he added.
"He told me that if anybody asked, they were running away and the Iraqi army shot them."
Sgt Wuterich's lawyer, Neal Puckett, said Sgt Dela Cruz's account was "false" and that he had told investigators up to five different versions of the events.
"It's unfortunate that in exchange for his freedom he's being forced to testify against his brothers," Mr Puckett told the Associated Press.
In April, the Marine Corps dropped all charges against Sgt Dela Cruz and granted him immunity in exchange for his testimony.
If found guilty, the three marines charged with second-degree murder could face life imprisonment.
The Haditha inquiry is just one of a number the US military has been conducting into incidents of alleged unlawful killings by US forces in Iraq.