Gunmen killed 29 women after storming a suspected brothel in the Shia Zayouna district in the east of Baghdad.
A senior police officer said that the attackers used silenced weapons and were wearing plain clothes and camouflage.
Police said that 18 other people were wounded in the attack.
"This is the fate of any prostitution," read an inscription on the door of the one of the raided buildings.
"When we walked up the stairs, we saw a couple of women's bodies and blood streaming down the stairs," a police colonel, speaking on condition of anonymity, told AFP.
"We entered a flat and found bodies everywhere, some lying on the sofa, some on the ground, and one woman who apparently had tried to hide in a cupboard in the kitchen shot to death there."
AFP reported that several people were arrested after the attack.
In May 2013, 12 people were killed in a similar series of raids, and two months later two women were killed in the mainly Shia neighbourhood.
With the Iraqi army locked in combat with Sunni militants from the Isis group which has seized swathes of the north and east of the country, Shia militias have started to patrol the streets of Baghdad.
Locals accuse Shia militias of targeting women they believe to be prostitutes, Reuters reports.
Under Islam, prostitution is forbidden.
No group has claimed responsibility for the attack.
On Sunday, Sunni militants attacked a town north of Baghdad, seizing police and government buildings.
Witnesses said the militants in 50 to 60 vehicles stormed the town of Dhuluiya, about 70km (45 miles) north of the capital, in the early hours of the morning.
Four policemen, two militants and two civilians have been reported killed in the fighting.
Insurgents also bombed a bridge linking Dhuliya to the nearby Shiite town of Balad to the west.