Charles, known as the Duke of Rothesay in Scotland, wore a kilt and a specially-monogrammed overall to drive the steam engine on a line in Aberdeenshire he used to travel on as a child.
The prince stepped in with a “significant” donation through his charitable foundation after hearing vandals had smashed windows on a 1965 railway carriage and ruined a locomotive engine at the historic Deeside line at Milton of Crathes, Banchory, in August 2015.
His donation helped carry out a £15,000 refurbishment and he visited the station on Monday, meeting Royal Deeside Railway Preservation Society volunteers and local schoolchildren before climbing aboard the engine.
Volunteer driver James West showed him the controls and said he was a “very good” driver on the short journey on a reconstructed section of the historic line towards Banchory and back.
Mr West said: “I never thought I’d teach the future King to drive a stream train.
“He’s driven similar trains before, so kind of understood how they work.
“We chatted on the way down the line about how he’d travelled on the line as a child and he never believed he would travel on it again.
“He took the controls and did all the driving. I did the braking as we approached the platform. His driving was very good.”
Charles unveiled a plaque naming the restored carriage Birkhall after his residence at Balmoral.
The historic railway line was in use from 1853 to 1966 and was used by the royal family on trips to the Aberdeenshire estate.
Restoration project leader Bill Halliday said the prince’s donation had given the impetus to kickstart the renovation and helped draw in more public contributions, and said the royal visit was “absolutely fantastic”.
He said: “It was a great end to what started off as a devastating incident with the vandalism. This was the perfect completion for us.
“He used to travel on the line as a child, it brought back great memories for him. Driving the train just made his day, he was absolutely delighted and he really enjoyed it.”
He said Charles urged the society to persevere with their goal of restoring the line between Ballater and Crathes.