Pele left a hospital in Sao Paulo after undergoing prostate surgery.
The 74-year-old Brazilian football legend was admitted to Albert Einstein Hospital in Sao Paulo on May 5 for the second time in six months.
Pele, a three-time World Cup winner, was treated for a urinary tract infection in November 2014 after removing kidney stones.
He was named FIFA Player of the Century and won 91 games for Brazil, scoring 77 goals.
Widely considered the greatest player of all time, Pele scored a world record of 1281 goals in 1363 appearances in his 21-year career.
He played 14 World Cup games, scoring 12 goals and was awarded the FIFA Ballon d’Or as the best player of the 1970 tournament.
Pele has only one kidney after removing one towards the end of his playing career.