Disaster was averted by quick-thinking Taieri Gorge Railway staff when a locomotive erupted in flames while on a viaduct in Otago yesterday afternoon.

The popular tourist train was bound for Pukerangi, northwest of Dunedin, being towed by two locomotives, when the second one, an unmanned locomotive, began to smoke just 20 minutes from its destination.

The driver of the front locomotive, Jarrod Olliver, said the first instinct of staff was to get the 32 passengers off the train while parked on a viaduct, before they tackled the source of the flames.

Train guard Joe Carson, 62, climbed on to the locomotive and emptied a fire extinguisher into the engine bay, before using a crowbar to prise open the smoking engine.

Mr Olliver said rather than risk the viaduct and the nearby countryside, he and fellow driver Graham Fahey decided to detach the carriages and take the now-flaming locomotive to Pukerangi.

"It was a scary experience. I never want to do something like that again."

A further five extinguishers were used at Pukerangi, before the nearby Middlemarch Fire Service arrived to extinguish the flames.

The damaged locomotive was uncoupled while the other engine went to bring the passengers to their original destination.

It was an educational trip with a difference for Otago Polytechnic student Kathryn Bennett, who was on the train as part of a paper she is studying on tourism transport.

"We learned a lot about what to do in an emergency. The staff were great."

Taieri Gorge Railway head Murray Bond said the cause of the fire was not yet known.

Despite the hiccup, he said, passengers were returned to Dunedin Railway Station only 90 minutes late.

- Otago Daily Times