The 75-year-old smiled and waved as he left the private hospital in the suburbs of Madrid.
He said he was "well, very well thank you, as you can see" as he was driven away from the groups of well-wishers and press who had gathered to see him leaving.
"His Majesty King Juan Carlos has been discharged from hospital after completing his post-operative period very satisfactorily and having achieved sufficient autonomy for daily life," a statement released by the hospital read.
"In the next few weeks Don Juan Carlos will continue with his treatment, post-operative check-ups and his planned recovery programme as an outpatient," it added.
The King will now return to his primary residence, the Zarzuela Palace near Madrid to continue his recovery.
U.S. surgeon Robert Trousdale of the Mayo Clinic in Minnesota flew to Spain especially to carry out the three-hour long hip surgery, alongside Dr. Miguel Cabanela.
The King will have to undergo a second operation within the next two months to implant a new, permanent artificial left hip, as the one inserted last week was a temporary measure following infection in the tissue surrounding the artificial hip.
He received visits from his wife Queen Sofia, his son Prince Felipe and his wife Princess Letizia and their daughters Infanta Leonor and Infanta Sofia during his stay.