The Pope had already praised Benedict's dedication to the faith in previous days.Around 130 cardinals were also in attendance, Vatican spokesman Matteo Bruni said. Among them were the German Cardinals Reinhard Marx, Rainer Maria Woelki and Gerhard Ludwig Müller.
There was an official German delegation present, including President Frank-Walter Steinmeier, Chancellor Olaf Scholz and Markus Söder, premier of largely Catholic Bavaria, where Benedict was born as Joseph Ratzinger in 1927.
Benedict had expressed the wish that people from his native Bavaria attend. He was born in the village of Marktl, near the border with Austria.
According to the Italian news agency ANSA, 300 bishops were among the guests.
In a touching moment, Georg Gänswein, the cleric who served as Benedict XVI's personal secretary and confidant during his papacy, bent over the coffin to kiss it after it was brought out onto St Peter's Square.
Gänswein was perhaps the closest person to Benedict in his final years. He served as the pope's private secretary after Benedict's election in 2005 after previously working with him in Rome.
He was appointed prefect of the pontifical household in December 2012 and raised to the rank of archbishop.
Benedict was often criticized for being too rigid as pope, but he was not an archconservative stuck in the past, in the view of German Cardinal Walter Kasper.
"On meeting him in person, one saw that he was not a diehard," the 89-year-old cardinal - who served Benedict in the papal curia during his pontificate - told Bavarian television before participating in the funeral service on St Peter's Square.
The late pope had been a "friendly person full of hope," Kasper said, relating how he had received a letter from Benedict dated October 10 - just weeks before his death. "At the end, he was at peace with himself, with the church and with God," Kasper said.
Looking back on the 60 years he had known Joseph Ratzinger, Kasper said: "Those were very good conversations and meetings, and I have to say, I miss them now. Perhaps we can continue them in heaven."
After the service, Benedict's body was to be buried in the crypt of St Peter's Basilica.
Benedict XVI died at the Vatican on New Year's Eve at the age of 95. He had been lying in state in St Peter's Basilica since Monday so that the public could pay their respects.