Driver Harvinder Singh after spotting the fire in the engine of 2 MD passenger train stopped it at Shahibabad railway station, Fire officer Mukesh Kumar said.
No one was injured and all passengers got down safely at Shahibabad station, he said.
According to the fire official, the issue was brought to their knowledge by the railway authorities around 10:30 am.
Two fire tenders were rushed to the spot to douse the fire, he said, adding around two hours later a replacement engine arrived and the train resumed its journey to Moradabad.
The movement of various trains on the Delhi-Howrah route remained disrupted due to this incident, they said.