In addition to the main race, the Rotary Challenge, which follows a 14-mile route alongside the railway up and down the valley, there were three shorter races for different age groups.
A total of 940 runners took part, down substantially from the 1,780 before the pandemic.
Now organisers are urging runners to return to the event in 2023.
Talyllyn Railway ran special trains for the event and also carried spectators and runners for all the races. More than 980 passengers travelled on the special trains and 437 runners completed the main event pitting trying to beat the train up the Talyllyn Valley and back to Tywyn.
Sullivan Smith from Cambridge & Coleridge Athletics Club was first home in 1 hour, 29 minutes and 27 seconds while Ellie Haf was first lady in 1 hour, 47 minutes and 10 seconds. The train crossed the line in 1 hour and 48 minutes, right on time.
Next year’s 38th ‘Race the Train’ event takes place on Saturday, August 19 and the rotary club’s website is open for entries.
Jonathan Mann, Talyllyn Railway preservation society chairman, said: “It was wonderful to see the race return to Tywyn after its enforced absence. It’s a great event for the area and brings in many people.
“Whilst it is not surprising that numbers were down, it was nonetheless great fun for all and we look forward keenly to next year’s event, hopefully with a return to greater numbers as we all return to a more normal way of life."
Talyllyn Railway is a narrow-gauge railway which opened for goods traffic in 1865 and for passenger services, shortly after, which have operated every year since between Tywyn and Nant Gwernol, seven miles inland.
It is organised by Tywyn Rotary Club and Talyllyn Railway.