"People were still sleeping and couldn't do anything," local official Danang Susanto told the AFP news agency.
"Many people are still trapped and the rescue is ongoing."
Television footage showed rescue workers wading through deep water and bodies being pulled from the mud.
Indonesia's President Susilo Bambang Yudhoyono sent his condolences to the families of the victims and officials said he was planning to travel to the scene of the disaster later in the day.
Vice-President Yusuf Kalla and Welfare Minister Aburizal Bakrie have already visited.
"We will provide emergency help to the victims. For those whose homes were destroyed, the government will help with the repairs," Mr Kalla told Metro TV.
Sirens
The decades-old dam had been holding back a lake of about two million cubic metres of water.
One resident said the dam broke after the morning call to prayer.
SITU GINTUNG DAM
Earthen dam, made of compacted earth
Built in the early 1900s under Dutch colonial rule
Surrounds man-made lake on south-west edge of Jakarta
Thought to have released two million cubic metres (70 million cubic ft) of water
"I took all my family out of the house and I saw my neighbour with his pregnant wife drifting away. They asked for help but the water was so fast," Hamdani said.
Another resident, Seto Mulyadi, said he heard a siren from the dam before water crashed into his house, breaking through all the windows and doors and leaving water 2.5m (8ft) deep.
"A flash flood came suddenly and was horrifying," he was quoted as saying by the Associated Press news agency.
"My house in a dreadful mess. Thank God my family is safe."
One man told local media it had been "like being in a tsunami".
People were screaming 'the water's coming in, the water's coming in,' and our dog was barking," a local resident told Detikcom news website.
"I could hear our door being pounded on and I wondered who could it be, but it was the water."
"Rustam Pakaya, head of the Health Ministry Crisis Centre, said people in the area were being evacuated to higher ground.
"About half of them are still on rooftops waiting for help," he said.
South Jakarta Police chief Makmur Simbolon told AP that it was not yet known what had caused the failure of the 10m (32ft) dam, which was apparently earthen.
The BBC's Katherine Demopoulos in Jakarta says the city is prone to floods and has an ageing, poorly maintained drainage system which struggles to cope with heavy rainfall.
In 2007, floods in the capital left more than 50 people dead.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.
Bookmark with:
What are these?