Earlier he received a sustained ovation when he entered the Paul VI hall in the Vatican for his penultimate general audience, Vatican Radio reported.
"Continue to pray for me, for the church, for the future pope. The Lord will guide us," Benedict said.
The service Wednesday was moved from a smaller basilica, Sant' Anselmo Church, to St. Peter's Basilica to let more worshipers say goodbye, the Vatican said.
It also spared the pope, 85, the effort of a long procession scheduled at the smaller church, the British Broadcasting Corp. noted.
Looking tired at the service attended by cardinals, monks and pilgrims, the pontiff anointed the foreheads of the faithful with ashes in the Ash Wednesday ceremony which marked the start of the Lent, the solemn 40-day period ending with Easter Sunday, the BBC said.
Benedict, 85, announced he was resigning Monday, saying he thought he was no longer capable of being pontiff.
"Thank you for your kindness," he said, commenting later, "I have felt, almost physically, your prayers in these days which are not easy for me, the strength which the love of the church and your prayers brings to me."
Even though he no longer will be the leader of the Catholic Church, the pontiff said: "What sustains and illuminates me is the certainty that the church belongs to Christ whose care and guidance will never be lacking. I thank you all for the love and prayer with which you have accompanied me."
The pope's appearances Wednesday gave his followers a chance to see and hear him before he withdraws into seclusion in a former convent within Vatican City where an apartment is being prepared for him, The New York Times reported.
Vatican officials said Tuesday the practical consequences of Benedict's decision to vacate the papacy are still being sorted out, including how to address the former pope and what to do with the papal ring used to seal important documents. The ring traditionally is destroyed when a pope dies.
Officials also revealed Tuesday that a cardiac pacemaker had been implanted in the pope about 10 years ago, but said this hadn't been a major health issue and did not factor into his reasons for resigning.
"There are a series of questions that remain to be seen, also on the part of the pope himself, even if it is a decision that he had made some time ago," Vatican spokesman Federico Lombardi said during a news conference. "How he will live afterward, which will be very different from how he lives now, will require time and tranquility and reflection and a moment of adaptation to a new situation."
When he retires, the pope can move freely about, Lombardi said, adding that it would be "premature" to say how involved he will be in day-to-day activities at the Vatican.
Lombardi said the pope would not get involved in the selection of his successor.
"You can be sure that the cardinals will be autonomous in their decision and he will have no specific role in this election," Lombardi said, adding the pope was "a very discreet person."
The conclave to choose the next pope will begin 15-20 days after Benedict resigns, and a pope is expected to be installed by Easter, which is March 31.
Caroline Berg Eriksen: Soccer player's wife triggers debate with post-birth selfie
Texas principal bans speaking Spanish, stirs controversy