Brazil's under-fire President Michel Temer was discharged from hospital in Sao Paolo on Monday after undergoing prostate surgery, his office said.
"Following medical recommendations, he will go to his home in Sao Paolo to rest," the president's office said.
Television images showed the 77-year-old Temer leaving the Sirio-Libanes hospital at noon, apparently in good shape.
Doctors performed surgery on Temer for a benign prostatic hyperplasia, or enlarged prostate, on Friday night.
"Everything went well. Now I'm going to work from home," Temer told waiting journalists.
Temer is expected to return to the capital Brasilia on Wednesday, a spokesperson for the presidency told AFP.
The health scare forced the cancellation of a visit by Bolivian President Evo Morales, which had been scheduled for Monday.
Temer was admitted to hospital in Sao Paolo on Friday for what was then described as a medical check-up.
Two days earlier he had been taken to the Army Hospital in Brasilia complaining of discomfort, and underwent an examination with a urinary catheter.
He was released just as Brazil's Congress voted to reject corruption charges against him, meaning that he will not have to face trial -- as long as he remains in office -- and is free to pursue austerity reforms in Latin America's biggest economy.
Following the medical scare, Temer said, "I am in one piece."
The first president in the country to face criminal charges while still in office, Temer is accused of obstruction of justice and racketeering. He denies any wrongdoing.
On October 11, Temer was diagnosed with a slight blockage of a coronary artery, his office said. He was put on a low-fat diet and told to take aspirin.
Polls show Temer is Brazil's most unpopular leader on record and among the most unpopular in the world.