A passenger train smashed into a truck at a level crossing in South Africa on Thursday, killing at least 18 people, injuring 254 and throwing several carriages off the rails.

Flames ripped through the twisted wreckage and choking black smoke rose into the air as desperate passengers clambered out of the train travelling from Port Elizabeth to Johannesburg to escape the inferno.

Tiaan Esterhuizen, who was travelling on the train as he returned from holiday, attempted to rescue three women who were trapped in a burning passenger wagon.

"I saw around 12 cars on their side and one was already burning. We heard some women screaming when we came closer' so a few of us climbed over the cars," he told the Times LIVE news site.

"Two of the women were sort of on top of each other. Another was further back. Her legs were trapped. One of the women was shouting that there was a baby inside also.