Gunmen killed 25 women and wounded at least eight people when they stormed two buildings in a Baghdad compound reputedly used for prostitution.
The attack on Saturday appears to be one of the worst in the capital since Sunni Arab insurgents seized vast swathes of the country last month.
The killings recalled the carnage of Iraq's sectarian civil war of 2006 to 2007, when death squads roamed the streets, killing thousands.
Police cordoned off the area, and eyewitnesses said several people were arrested.
"This is the fate of any prostitution," read a inscription on the door of the one of the raided buildings.
A police officer described the gruesome scene. "When we walked up the stairs, we saw a couple of women's bodies and blood streaming down the stairs.
"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."
Shiite militias have been accused of carrying out killings of women branded as prostitutes in that district of the capital, though there was no way to immediately confirm who was responsible for the attack.
Similar raids killed 12 people in May 2013, and three women two months later, in the same mainly Shiite neighbourhood.
Shiite militias have become more active on the streets of Baghdad since the invasion of eastern and northern Iraq by jihadis a month ago.
Zayouna, home to many military officers who previously served under executed strongman Saddam Hussein, remains one of Baghdad's most affluent neighbourhoods.
Unlike many of the capital's districts, Zayouna retains a mix of Shiite and Sunni Muslims, and is home to some members of Iraq's small Christian minority.
South of Baghdad, the Iraqi army also seized a large cache of weapons, including explosives and wires used to detonate improvised bombs, according to a statement released on Saturday by the Ministry of Defence.
The deteriorating security situation in the capital comes as Iraqi government forces scramble to secure Baghdad and recapture territory lost to the insurgents last month.
The government has bolstered its forces with militias composed mostly of Shiite volunteers, many with little or no training.
The army said on Saturday that an additional 4,000 Shiite volunteers would be sent to the western city of Ramadi to combat "extremists".
Agence France-Presse, The Washington Post, Reuters
Former Saddam aide Ezzat Ibrahim al-Douri calls for 'liberation' of Iraq
A purported message from a close aide to late dictator Saddam Hussein urges Iraqis to join efforts to "liberate" the country and praises militants who led last month's offensive through northern Iraq.
The voice recording released on a website was said to have been made by Ezzat Ibrahim al-Douri, the top entourage member still at large following Saddam's 2003 overthrow.
Although reportedly in poor health, Douri is believed to lead a Baathist militant group, one of several which supported the Islamic State of Iraq and the Levant (ISIL) in its assault through Sunni provinces of northern and western Iraq last month.
"Join the ranks of the rebels who liberated half the country," said the voice on the recording, which resembled previous tapes released in Douri's name. The offensive has been halted north of Baghdad.
In the 15-minute tape, the speaker praised the "heroes and knights of al-Qaeda and the Islamic state" as well as other groups fighting the "Persian, Safavid colonialisation" of Iraq, a reference to the Shiite-led government of Prime Minister Nuri al-Maliki.
But he also hinted at the increasingly evident divisions among the various groups fighting Maliki's forces, saying it was important to put off their differences in the interests of unity.
Shortly after taking the city of Mosul, ISIL militants began arresting senior members of the Baath Party, residents and relatives said.