Rescuers were still trying to reach several people trapped inside the crumpled carriages hours after the crash.
The accident occurred at around 2:30 am on the outskirts of Banjar, a village in West Java province, 170 miles (270 kilometers) from the capital, Jakarta. "We don't know why they were on the same track," said Bambang Ervan, a spokesman for the Transportation Ministry. "We're still investigating."
He said a passenger train traveling eastward from the city of Bandung collided with a westbound train from Surabaya. Railway spokesman Bambang Supriyanto said at least five people were killed and 21 others were hospitalised, some in critical condition.
Phone calls to police and hospital officials went unanswered early today. Train accidents are common on Indonesia's aging railway network, especially at crossings.