Police said human error was to blame for the accident, which happened before dawn at a station in Petarukan Pemalang, Central Java province, although the official cause was still under investigation.
"Thirty-six people were killed and more than 30 were badly injured," national police spokesman Iskandar Hasan said.
All of the passengers had been freed from the train, according to a spokesman for the transport ministry.
"All the victims have been extracted from the train and taken to hospital," Bambang Ervan told AFP.
Officers at the scene said a train headed to Surabaya smashed into the rear carriages of a Semarang-bound locomotive that was waiting at the platform.
Ten hours after the accident the death toll was still being updated, amid media reports that rescuer arrived late and lacked proper equipment to free passengers trapped in the wreckage.
National railway operator spokesman Sugeng Priyono said the rescue was delayed.
"The rescue came late today because the heavy machinery (needed for the rescue) was located far away from the accident location," he said.
Many of the dead and injured were trapped in three carriages, which had derailed and flipped over, officials said.
A man living beside the station said the noise of the collision woke him from his sleep. Then he heard people wailing.
"Suddenly I heard a loud crashing and the sound of many people crying. I saw many passengers had been thrown outside the carriages," he said.
A passenger on the stationary train said he was asleep when he felt a powerful thump and fled the carriage.
"It was really scary. I went outside and realised that the rear carriages had been smashed," he said.
A survivor from the other train said he was "very traumatised".
"I don't want to ride in trains anymore," he was quoted as saying by Detik news website.
National police spokesman Iskandar Hasan said the accident was believed to be a result of human error.
"The suspected cause of the accident was a mistake in the traffic management system," he said.
A team of investigators had been sent from Jakarta.
Transportation minister Freddy Numberi said the state railway operator would undergo a complete evaluation in relation to the Petarukan Pemalang accident. "The evaluation will reveal the true cause of the train accident that killed dozens of people, whether it was caused by human error or others," Numberi was quoted as saying by state news agency Antara.
"The qualification and certification of the machinists need to be improved so they can be truly reliable and professional in their jobs," he said.
Numberi said he was deeply concerned and felt sorry for the deaths.
In June eight people were killed when several carriages of a packed passenger train derailed as it travelled across Java, one of the most densely populated islands in the world.
Poor infrastructure, corruption and weak safety standards are often cited as factors contributing to frequent transport disasters in Indonesia, especially on ferries linking the country's thousands of islands.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ