Prince Philip will celebrate his 91st birthday at home today, after five days of hospital treatment for a bladder infection.
The outspoken Duke of Edinburgh left London's King Edward VII hospital overnight NZ time, just in time for his birthday.
He was hospitalised in the midst of Britain's huge diamond jubilee celebrations marking the Queen's 60 years on the throne.
A Buckingham Palace spokesman says Philip, the longest-serving royal consort in British history and the Queen's stalwart companion throughout her reign, will mark his birthday privately "at home''.
His illness comes six months after he was treated for a blocked coronary artery after suffering chest pains.
The prince was in good spirits as he walked out of hospital, shaking hands with staff and smiling.
Asked if he was feeling better, he quipped: "Well, I wouldn't be coming out if I wasn't.''
He was driven to Windsor Castle near London, the BBC reported.
Two gun salutes will be fired in London on Monday to mark his birthday, but a palace spokesman said it was not yet known whether he will be able to carry out his hectic schedule of royal engagements in the coming week.
"He continues to make a good recovery and will continue his convalescence at home,'' the spokesman said.
The illness forced Philip to miss the final two days of Britain's jubilee celebrations, including Monday's spectacular pop concert outside Buckingham Palace.
Crowds at the concert cheered and shouted "Philip! Philip!'' after heir to the throne Prince Charles suggested, ``If we shout loud enough, he might just hear us in hospital.''
The Duke also missed an appearance by the main royals on the palace balcony on Tuesday, when crowds of flag-waving revellers again surrounded the building in a sea of red, white and blue.
Philip's health has generally been good but he said before his 90th birthday he would scale down his engagements.