One train had been stationary at Petarukan station
A train crash near the Indonesian city of Pemalang in Central Java province has killed at least 35 people, officials say.
Dozens more were hurt and many bodies were trapped in the carriages, though almost all have now been retrieved.
The crash happened before dawn, when a train from the capital Jakarta hit a stationary train at Petarukan station.
Officials said the most likely reason for the accident was a signalling error.
Continue reading the main story
Related stories
In pictures: Indonesian train crash
The BBC's Karishma Vaswani in Jakarta says train accidents are common in Indonesia, with officials often citing human error, badly maintained trains and a lack of investment in rail infrastructure as the causes.
High speed
The train from the capital was heading to Surabaya when it crashed into the back of another train bound for Semarang that was stationary at a platform at about 0300 on Saturday (2000GMT Friday).
The train from Jakarta was travelling at high speed, officials said.
Most of the dead and injured were in three carriages which were derailed and overturned.
At least 40 people are reported injured, many with broken bones or burns. All have now been taken from the scene and are being treated in hospital.
One witness living close to the station told Agence France-Presse news agency: "Suddenly I heard a loud crashing and the sound of many people crying. I saw many passengers had been thrown outside the carriages."
One passenger on the stationary train told AFP: "It was really scary. I went outside and realised that the rear carriages had been smashed."
National police spokesman Iskandar Hasan said: "The suspected cause of the accident was a mistake in the traffic management system."
Transport ministry spokesman Bambang Ervan added: "It may have been mechanical. We're checking to see if the signals of the parked train were working properly."
There were also reports of a second train crash in the town of Solo, which left one person dead.
Mr Ervan said that information was still being collected on casualties there.
Six died in a train crash in East Java in June.