Oswald Davies described his actions in failing to use a level crossing properly as "terrifying", and said he was thankful nobody had been killed.
He did not follow the instructions to phone the signalman to get permission to cross.
As he crossed, the barrier on the opposite side came down, blocking his path. He stopped his lorry and had just got out of the cab when he was hit by the Milford Haven to Manchester Piccadilly train.
The court heard how the train driver had seen the lorry on the track, applied the emergency brake, ran out of his cab and dragged a colleague with him, helping them both avoid injury.
49 passengers were on board the train, travelling at 68mph, and four were taken to hospital suffering minor injuries.
The crash cost Arriva Trains Wales £819,821 - including the recovery of the train, repair costs and the running of replacement services.
The line was closed for two days for the vehicles to be recovered.
Chief Inspector Sandra England from British Transport Police Welsh Sector said: "It is astounding that no one was seriously injured or killed. Davies' actions not only put rail staff and passengers' lives at risk, but also caused massive disruption to rail infrastructure."
"Taking a chance at a level crossing can have dire consequences. Stop, think and be sensible, because one moment of impatience could result in lives being destroyed."
More top news
Sam Warburton has pledged to get behind the man who replaced him as Wales captain when the Six Nations kicks off the weekend after next.
A cold and frosty night with a warning for freezing fog inland. Coasts will feel slightly milder, remaining frost-free!
A man from the Rhondda Valley is celebrating the history of coal mining in South Wales - having his camper van sprayed with mining motifs.