The accident in southern Jakarta killed the train driver and at least six other people, police said, and about 20 others were injured.
A burned-out passenger car was seen lying on its side while plumes of black smoke billowed from parts of the engulfed train run by PT KAI Commuter train company.
The train was heading for central Jakarta when the accident occurred just before noon, said company spokeswoman Eva Chairunisa. She said the truck was carrying LPG, but police said it was petrol.
Two carriages derailed during the accident and hundreds of passengers ran from the train, many screaming and crying.
Rescuers worked to pull out three bodies pinned under the wreckage. The cause of the accident is being investigated.
A passenger of a derailed carriage who managed to escape said the train appeared to slam on its brakes just before impact. She said she heard explosions and then the car filled with thick smoke, making it difficult to breathe.
"My position was near the door, but I could not move because I was trampled by other passengers," said Veronica, who uses only one name and was travelling in a carriage reserved for women.