The King smiled and waved saying he was "very well, very well, as you can see" as he was driven away from a private Madrid hospital where surgeons gave him a temporary hip replacement in a two-and-a-half-hour operation on September 24th because of an infection around the previous prosthetic joint.
"His Majesty King Juan Carlos received his hospital discharge after having completed his post-operative period very satisfactorily and having achieved sufficient autonomy for daily life," said a statement by the private Quiron Hospital in the western suburbs of Madrid.
"In the next few weeks Don Juan Carlos will continue with his treatment, post-operative checkups and his planned recovery programme as an outpatient," the hospital said.
The head of state must now fight off the infection with the aid of intravenous antibiotics before undergoing yet another operation in about two months to fit a permanent replacement joint.
The temporary hip replacement was the King's eighth operation in three years, feeding speculation of a possible abdication in favour of his son Felipe, 45, despite palace denials.
Juan Carlos is widely respected for his role in guiding Spain's transition to democracy after the death of longtime dictator General Francisco Franco in 1975 but his image has suffered in particular because of a corruption scandal implicating his youngest daughter Cristina.
Cristina's husband Inaki Urdangarin has been under investigation since late 2011 for allegedly embezzling millions of euros paid by regional governments to the Nóos Institute, a charitable organisation which he chaired from 2004 to 2006.
The King himself sparked outrage last year for taking an expensive elephant-hunting holiday in Botswana, while Spain struggled through a recession that has left one in four people out of work.
The trip became public knowledge after the head of state broke his hip and had to be flown home for medical care.
Announcing news of the operation last month, the royal palace said however that Juan Carlos had at no time considered abdicating nor handing over his powers to Felipe while he recovers from surgery.