The 74-year-old was admitted to the Albert Einstein Hospital on Wednesday with abdominal pains that forced him to cancel a book signing event in Santos, where he lives.
Tests showed he was suffering from kidney and ureteral stones that were removed on Thursday morning, the doctors said in a statement.
"He is clinically stable and in recovery," they added.
Known as "the King of soccer" in Brazil, Pele is widely regarded as the finest player to grace the sport. He played in four World Cups and helped Brazil win the global tournament three times, the last in Mexico in 1970.
Image: Pele
Photograph: Vittorio Zunino Celotto/Getty Images for Golden Foot
Sports Shorts: Soccer star Pele to leave hospital soon
Keen to have you visit, Chinese PM tells Modi in Myanmar
Kendall Jenner is high street fashion's newest sweetheart!
Formula One: Force India's Hulkenberg gets four points at Brazil GP
UK, France support India as permanent member of UNSC