The Duke of Edinburgh left King Edward VII Hospital in London today in time for his 91st birthday.
Prince Philip, who is 90, had been in hospital with a bladder infection as a precautionary measure since Monday and missed part of the Queen's Diamond Jubilee celebrations.
Upon leaving Philip shook hands with and thanked staff at the central London hospital after spending five days there.
The Duke got into the front passenger seat of a Land Rover Discovery vehicle before being driven away from the hospital, with a police escort.
When reporters shouted out questions about whether he was feeling better, the Duke nodded.
A Buckingham Palace spokesman said the Duke would be spending his birthday "privately".
"The Duke of Edinburgh continues to make a good recovery and he will continue his convalescence at home.
"He will spend the weekend privately."
On Friday he enjoyed the company of grandsons the Duke of Cambridge and Prince Harry who paid a short, private visit.
William visited his grandfather while on leave from his RAF Search and Rescue duties.
Harry, meanwhile, was spending the week since the Diamond Jubilee celebrations on pre-deployment training at Wattisham in Suffolk.
The Princes, dressed in jeans and V-neck jumpers, left the hospital after 20 minutes without commenting.
Philip had already been visited by the Queen, the Duke of York, the Earl and Countess of Wessex and their children, Louise and James.
Andrew said on Wednesday his father was "mending very well".
Philip has been planning to celebrate his birthday privately and is not due to attend his next scheduled engagement until Tuesday, when the Queen hosts a garden party at the Sandringham Estate to mark her Diamond Jubilee.
It is hoped her husband will be by her side at her Norfolk retreat if he is feeling strong enough following his discharge from hospital.
It is also hoped he will be able to accompany her to the East Midlands on Wednesday for a two-day visit as part of the Queen's Jubilee tour of the UK.
Philip's admission to hospital meant he was forced to miss some of the Jubilee celebrations this week.
He spent Sunday braving the elements for the Thames River Pageant, which doctors suggested might have exacerbated his condition if he did not make enough visits to the toilet.
The Palace said earlier this week that he was being treated with antibiotics and was in good spirits.