Prince Philip, the Duke of Edinburgh, has left Papworth Hospital in Cambridgeshire after four nights.
Buckingham Palace said Prince Phillip will now return to the Royal Family’s Sandringham estate in Norfolk.
The Duke of Edinburgh had been in Papworth Hospital since Friday when he had a coronary stent fitted after being admitted following chest pains.
Prince Philip, who left by road and waved to reporters, missed the royal Christmas celebrations and had to sit out the traditional Boxing Day shoot.
He sat upright and smiled broadly as he left the hospital.
In a statement, Buckingham Palace said: “On departure, Prince Philip thanked the staff at Papworth for the excellent care he has received during his stay.
“He is very much looking forward to rejoining his family.”
The Duke of Edinburgh is said to have been advised by doctors to rest.
The Queen, 85, has been briefed regularly on her husband’s condition.
On his arrival at Papworth Hospital doctors discovered a blocked artery and went ahead with a “minimally invasive procedure of coronary stenting”, which was declared a success.
Stenting involves inserting a tube called a stent into an artery, to improve blood flow.
The Duke of Edinburgh’s next formal engagement is not until 17 January when he is due to attend a dinner at the Scott Polar Research Institute at the University of Cambridge.
Usually on Boxing Day Prince Philip would lead the Royal Family’s shooting party.
But this year he was under doctor’s orders not to leave his bed while he was kept under observation.
This is the most serious health scare suffered by the normally spry nonagenarian.
Prince Philip usually accompanies the Queen and in the autumn he travelled to Australia on a 11-day official visit to Perth, Melbourne, Canberra and Brisbane.