The attack in the Iraqi capital was under a highway flyover and near a hospital in the east of the city on Wednesday morning, a police source said.
The dead were reportedly day labourers looking for casual work. More than 28 others were wounded.
Iraqi and US troops are currently struggling to assert government control over the capital and stiffle surging sectarian violence.
To bolster security the US reinforced the capital with more troops last week.
There are now about 50,000 US and Iraqi forces conducting raids and searches throughout the city in an effort to kill or capture members of armed groups opposed to the Iraqi government.
Fighting in Basra and Mosul
In Basra, a mainly Shia city, Iraqi government buildings were attacked by gunmen.
Major Charlie Burbridge, a British military spokesman, said that about 30 British soldiers had been dispatched to reinforce Iraqi troops and police at the scene of the fighting.
Aljazeera television reported that the attacks were carried out by members of the Bani Asad tribe in protest at the assassination of one of their tribal leaders on Tuesday.
An Iraqi journalist, Abbas Muhammad, told Aljazeera that the Bani Asad believed that their sheikh was killed by men in a vehicle belonging to the governor's office.
"Bani Asad tribe is known to be a peaceful group of people who have no problems with any other parties. However, the killing of their leader has provoked them and led to this operation," Muhammad said.
In Mosul, Iraq's third largest city 390km (240 miles) north of Baghdad, police said they had killed six gunmen in the ethnically divided city.
Mosul was the scene of heavy fighting 10 days ago when US and Iraqi soldiers took several hours to restore calm.
Wednesday's fighting followed violence in the normally quiet Shia shrine town of Karbala on Tuesday between the Iraqi army and followers of Ayatollah Mahmud Al-Hasani, a senior Shia cleric.
The Iraqi defence ministry said on Wednesday that Tuesday's clashes there had left 12 dead, including two policemen.
Karbala was reportedly tense but quiet on Wednesday after the Iraqi government imposed a night-time curfew on Tuesday.