The Duke of Edinburgh smiled and nodded to reporters as he left hospital today in time to celebrate his 91st birthday tomorrow.
Philip shook hands with and thanked staff at King Edward VII Hospital in central London after spending five days there having treatment for a bladder infection.
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".
Yesterday, 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.
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.
A spokesman for Buckingham Palace said: "The Duke of Edinburgh continues to make a good recovery and he will continue his convalescence at home.
"He will spend the weekend privately."