US hip specialist Miguel Cabanela led the surgery at a Madrid hospital to give the frail-looking monarch a new left hip after the previous artificial joint fitted last November became infected and painful, making it hard to walk.
"Fortunately it has all gone well for his majesty, for us, for the country," Cabanela told a news conference after the two-and-a-half-hour operation at the private Quiron Hospital in the western suburbs of Madrid.
But the temporary hip replacement was the king's eighth operation in three years and news that more surgery must follow in two months or so will no doubt keep alive speculation of a possible abdication, despite palace denials.
Cabanela said the king would require a new operation for a permanent prosthetic hip after a period of at least eight weeks fighting off an infection in surrounding tissue.
First, he would require intravenous antibiotics for about six weeks and then a two-week period without the drugs.
The surgeon predicted Juan Carlos could be up and walking about six weeks after he finally receives a permanent, artificial hip.
"I am very well," the king told reporters earlier as he waved from his car window on arrival at the hospital.
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 Noos Institute, a charitable organisation which he chaired from 2004 to 2006.
Urdangarin has appeared in court for questioning as part of the probe but has not been formally charged with any crime.
In May, the judge leading the investigation demanded that tax authorities provide him with a report on Cristina's property and non-property assets, investment funds, financial assets and deposits as part of his probe into the affair.
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 head of state broke his hip during the trip and had to be flown home for medical care.
He issued an unprecedented public apology after his return but the hunting trip — reportedly subsidised and organised by Syrian construction magnate Mohamed Eyad Kayali — threw the spotlight on the royal family's deluxe lifestyle and raised questions about the sources of the royals' fortune.
The affair also drew attention to the king's friendship with Corrina Sayn-Wittgenstein, a blonde German aristocrat who is 28 years his junior, after it emerged that she accompanied him on the trip to Botswana.
The scandals and health concerns — the king has appeared on crutches, looking frail, at public functions — have fuelled speculation that he may turn a page in Spanish history by abdicating in favour of his son Felipe, 45.
Announcing news of the operation last week, 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.
The latest operation means Juan Carlos will almost certainly miss the annual Iberoamerican summit of Spanish, Portuguese and Latin American leaders in Panama from October 18th–19th.