Britain's 90-year-old Prince Philip, the husband of Queen Elizabeth II, left hospital on Saturday after five days of treatment for a bladder infection.
The prince shook hands with staff, smiled to reporters and nodded when asked if he was feeling better as he walked out of King Edward VII Hospital in central London in time for his 91st birthday Sunday.
Britain's longest-serving consort was taken to hospital on Monday with a bladder infection in the midst of the queen's diamond jubilee celebrations, less than six months after he needed treatment for a blocked coronary artery.
Wearing a suit and pink patterned tie, the prince walked slowly but without help from the hospital on Saturday to be whisked away in a Land Rover with police escort, appearing to be in good spirits.
Using the prince's formal title, a spokesman for Buckingham Palace said: "The Duke of Edinburgh was released from hospital this morning.
"He continues to make a good recovery and will continue his convalescence at home, and will be spending it privately."
He did not specify whether the prince would be going to the royal couple's official residence in Buckingham Palace or to Windsor Castle, just outside London. The couple normally divide their time between the two.
The palace said earlier in the week that the prince was being treated with antibiotics.
His illness forced him to miss the final two days of celebrations for Queen Elizabeth's 60 years on the throne, including a spectacular pop concert outside Buckingham Palace on Monday.
But he was at the Queen's side for a huge jubilee river pageant last Sunday, travelling with her on a sumptuous red and gold royal barge down the Thames in London accompanied by a flotilla of 1,000 boats.
Prince Philip, whose health has generally been good, suffered chest pains during the Christmas break and had to undergo a medical procedure for his blocked coronary artery.
It was not yet known whether Philip would be able to keep to his busy schedule of events next week, the spokesman said.
He is due to give a garden party with the queen at Sandringham House in Norfolk in eastern England on Tuesday.
The couple are also scheduled to attend a jubilee picnic in Lincolnshire, eastern England, on Wednesday and carry out more royal engagements on Wednesday and Thursday.
In his capacity as Colonel of the Grenadier Guards infantry regiment, the prince is due to chair a conference for senior colonels and hold a dinner at Buckingham Palace on Friday.
Prince Philip has been a constant by his wife's side throughout her 60 years as queen, having given up a naval career to be a full-time consort when she acceded to the throne in 1952.