The driver was at the controls of a train heading from London to Brighton when he saw the woman on the tracks in front of him - despite it being dark.
As he pulled into Burgess Hill station he slammed on the brakes and put out a warning to other trains to make sure they stopped.
He then made his was out of the train and tip toed between the live tracks to reach the 28-year-old woman who was in a great deal of distress.
After bringing her on board the train, he took the woman to Brighton where she was helped by paramedics.
One passenger took to his Twitter page to praise the driver, writing: ‘Well done to the train driver…who managed to get someone off the tracks and into safe arms.’
The woman was taken to hospital for assessment under the Mental Health Act.