It is the first time that Francis has been admitted to a hospital since becoming pope in 2013.

Pope Francis delivered prayers on Sunday morning from the window of his study at the Vatican.

The Vatican announced that Pope Francis had responded well to colon surgery in a hospital in Rome on Sunday evening, overcoming the first significant health challenge in a pontificate that has lasted more than eight years and shifted the priorities and direction of the Roman Catholic Church.

In a short statement released late Sunday night after the unexpected announcement of the pope’s hospitalization earlier in the day, Matteo Bruni, the Vatican spokesman, said that the operation had taken place while the pope was under general anesthesia and that Francis, 84, had “responded well.”

Earlier Sunday, Mr. Bruni stunned the faithful throughout the church when he announced that Francis had been taken to the Gemelli hospital in the Italian capital for “scheduled surgery” to treat symptomatic diverticular stenosis of the colon.

The surgery was performed by Dr. Sergio Alfieri, who heads the hospital’s operational unit for digestive surgery, the Vatican said.

Ten doctors, including Dr. Alfieri, and the pope’s personal physician, Dr. Roberto Bernabei, were present, Mr. Bruni said. He did not say how long the pope would be hospitalized, but the Italian media reported that he would remain at the hospital for several days.

It is the first time that Francis has been admitted to a hospital since becoming pope in 2013, and it comes at a time of tension in the church, with the Vatican this week indicting officials on charges of financial crimes, American bishops last month essentially disregarding Rome’s appeal to hold off on a politically fraught document about the Eucharist, and many in the church confused by Francis’ new warm words to L.G.B.T.Q. Catholics even as his church continues to hold a hard line.

Through it all, Francis, whose pontificate has been built around his personal style, charisma and expressed desire to reinvigorate the church, has stayed put and kept the power center with him in the Vatican. Unlike his predecessors, he has never left the Vatican for the cooler papal residence in Castel Gandolfo, near Rome, during the summer. He normally slows down his schedule in July.

Two days ago, Mr. Bruni announced that the weekly general audiences held on Wednesdays would be suspended for the month of July, and begin again on Aug. 4. He said the Sunday Angelus prayer and blessing would continue throughout the summer.

In remarks on Sunday before his hospitalization, Francis made no mention of the operation, and the Vatican offered little detail about his condition. But Francis did say in his weekly blessing on June 27, “Pray in a special way: the pope needs your prayers.”

Until now, the pope’s health has not been cause for much concern.

More than 60 years ago, he had an upper lobe of his lung removed as a result of complications from tuberculosis. And in recent years, his breathing has seemed labored during speeches. But Francis has maintained an often exhausting schedule during his foreign trips, most recently to Iraq in March.

He has, however, clearly slowed, in part because he has sciatica, a condition that causes leg and back pain, and he has missed some engagements. This past year, he missed New Year’s Eve and Day services because of a flare-up. Last year, he missed a Lenten retreat with senior aides because of a bad cold.

Though Francis underwent major surgery, the Vatican’s characterization of the procedure as scheduled — not urgent — was a good sign, according to Dr. Anne Peery, a gastroenterologist at the University of North Carolina in Chapel Hill. “I think there’s a very small chance that it is life-threatening,” Dr. Peery said.

Francis suffers from diverticulitis, a condition in the sigmoid colon in which saclike bulges on the colon walls become repeatedly inflamed or infected and can warrant surgical intervention, according to Dr. Feza Remzi, the director of the Inflammatory Bowel Disease Center at NYU Langone Health.

The pope arrived at the Gemelli hospital in the afternoon. He was accompanied by a driver and a “close collaborator,” the Italian news agency Ansa reported.

Francis was admitted to a suite of rooms on the 10th floor in one of the wings of the hospital, the same rooms occupied by Pope John Paul II during his hospital stays. John Paul was there so often as a patient that he often jokingly referred to the hospital as the “third Vatican.”

Illness and public suffering became hallmarks of the final years of the 26-year pontificate of John Paul, who suffered complications from Parkinson’s disease. His successor, Benedict XVI, stunned the world when he retired in 2013, saying he lacked the “strength of mind and body” to carry on.

Francis though, has kept working hard, despite an increasingly evident — and at times seemingly painful — limp and carrying extra weight. Last week, the pope celebrated a feast day Mass, presided over a prayer service for Lebanon and on June 28 held a long private audience with Antony J. Blinken, the U.S. secretary of state.

Earlier Sunday, Francis looked serene while addressing people gathered in St. Peter’s Square for the weekly Angelus prayer and blessing. Announcing that he would be visiting Slovakia in September, he smiled happily when cheers went up from the crowd.