The pontiff, who is 84 years old, was released at 10:30 a.m. local time (4:30 a.m. ET) from Gemelli Polytechnic hospital. On his way home to Casa Santa Maria in Vatican City, he stopped to pray at the Basilica of Saint Mary Major, Holy See spokesman Matteo Bruni said in the statement.
"He expressed his gratitude for the success of his surgery and offered a prayer for all the sick, especially those he had met during his stay in hospital," said Bruni in the statement.
Francis had the surgery for a severe narrowing of his large intestine on July 4, his first major surgery since he became pope in 2013. The Vatican said it was a planned procedure though it didn't release any details before he was admitted to the hospital. The surgery was scheduled for early July when his audiences are usually suspended and he would normally take some time off.
During his time in the hospital, he held his traditional Sunday Angelus address from the 10th floor balcony and spoke of the need for "free health care, that assures good service, accessible to everyone."
He also visited a pediatric cancer ward located on the same floor as the papal hospital suite, where he greeted children and their parents on Sunday and on Tuesday.
Download the NBC News app for breaking news and politics
Francis will have several more weeks to recover before beginning to travel again in September. He has plans to visit Hungary and Slovakia on a trip scheduled for Sept. 12-15. He will then visit Glasgow, Scotland in November to participate in the COP26 climate conference.
On Monday, the Vatican said the pope would spend a few more days in the hospital to aid in his recovery.
Born and raised in Argentina, the pope had part of one lung removed when he was a young man but has otherwise enjoyed relatively robust health.