Fire crews from Knaresborough, Harrogate, Boroughbridge, Ripon attended a train fire at 23:26 on 14 April 2016.
The fire service describe the train as being well alight, but no passengers were involved.
The train involved was a train operated by Volker rail and is used for engineering maintenance.
Fire crews used two large jets to extinguish the fire.
The fire was extinguished around 2am, and crews continued to dampen down and cool the train until 3am.
Investigations are ongoing in to the cause of the fire.
The line was not damaged and services are operating normally today.
A Network Rail spokesperson said:
Last night at around 11.20pm, an engineering train – one of the many which carry out essential maintenance and repairs to the track every night when passengers services are not running – caught fire near Knaresborough.
Nobody was hurt in the incident, which was attended by the fire service as well as Network Rail engineers.
The fire was extinguished at around 2am and the train was removed from the area, with Network Rail engineers able to ensure that the track was in a safe condition in time for the start of service this morning. The cause of the fire is currently under investigation.