A man had a miraculous escape on Wednesday, sustaining only minor injuries when a freight train rolled over the top of him while he slept between the tracks.

The man, 20, whose name has not been released, was sleeping at a level crossing in Port Augusta, Australia, when the train approached.

The driver spotted the man and applied the emergency brake, but the FreightLink train, carrying 3000 tons of freight, was unable to stop in time.

The train rolled over the man, still lying between the tracks, and stopped just ahead of him.

It is believed the man hit his head on the train while trying to sit up.

FreightLink general manager Tony Aldridge said the tracks were "not the best place" to take a nap. "It was probably lucky he was lying in such a way that the train actually went over him rather than across him," he said.

The train had slowed to enter the freight yard on Tassie Street. Aldridge said the clearance between the ground and the train was about 12 inches.

Ambulance officers took the man to Port Augusta hospital, where he was treated for minor injuries and expected to have been released.

"It certainly did traumatize our drivers, because the normal process is people are not as fortunate as this man was," Aldridge said.

A spokesman for the Australian Transport Safety Bureau said it was unlikely to investigate the incident.

The train was part of a normal Wednesday night service from Adelaide to Darwin. It was delayed in Port Augusta for an hour before continuing its journey.