The collision took place in Bekasi rail station between a commuter line train and a long-distance train, commuter line operator spokeswoman Karina Amanda told Reuters, adding that authorities were focused on freeing passengers and train crew.
Four people had been killed and 38 people taken to nearby hospitals, said Anne Purba, a spokeswoman for Indonesia's railway operator, speaking on local broadcaster Kompas TV.
"Given that the evacuation is still ongoing, it is possible that the number of victims could continue to rise but let us hope that the evacuation can be completed quickly," the deputy speaker of the Indonesian parliament, Sufmi Dasco Ahmad, told reporters at the site of the collision.
He said rescue officials were cutting through the wreckage to free at least six or seven people still found to be trapped inside.
The cause of the crash was not immediately clear, Karina said.
Jakarta police chief Asep Edi Suheri told reporters that the investigation into the incident was continuing.
Rescuers were seen using angle grinders to cut through the metal framework of train compartments in which commuters were trapped but seen alive.
At least 20 ambulances were seen at Bekasi station, Reuters witnesses said, with rescuers from Indonesia's rescue agency also in attendance to help extract passengers.
The Argo Bromo Anggrek long-distance train crashed into the rear car of a commuter train that was stopped at Bekasi Timur Station, causing severe damage.
The rear car had been designated for women only, a common accommodation to help avoid harassment.
with AP