The Mass was co-presided by Pope Francis's predecessor Benedict and broadcast live on large screens as well as around the world in cinema theatres and over radio.
It was a historic occasion for the Church, being the first time two popes have been canonised at the same time.
Some people camped overnight to make sure they secured a spot in the square, with many more gathering around to watch it on the giant screens nearby.
Pope Francis paid tribute to the two popes in his sermon, saying that although they lived through the "tragic events" of the 20th century "they were not overwhelmed by them".
"For them, God was more powerful," he said.
"In these two men, who looked upon the wounds of Christ and bore witness to his mercy, there dwelt a living hope and an indescribable and glorious joy. The hope and the joy which the risen Christ bestows on his disciples, the hope and the joy which nothing and no one can take from them."
The Vatican had been under pressure from the Catholic faithful to make Pope John Paul II a saint, a wish that was granted in just nine years, an unusually short canonisation process.
Only one miracle out of the two required to be canonised has been performed in the name of Pope John XXIII, but his life was deemed holy enough by Pope Francis, who waived the second miracle.
Two miracles are credited in Pope John Paul II's name. A French nun was cured of Parkinson's disease, and a woman from Costa Rica was cured of a brain aneurysm.
The Vatican said half a million people turned out to watch the canonisation in Rome, with the largest contingency being Polish.
Dignitaries at the event included King Juan Carlos and Queen Sofia of Spain, King Albert II and Queen Paola of Belgium, and the presidents of the European Union, Herman Van Rompuy, and the European Commission, Jose Manuel Barroso.
During the Mass, Cardinal Angelo Amato, prefect of the Congregation for the Causes of Saints, asked Pope Francis to inscribe the names of the two popes in the Book of Saints, and the Holy Father pronounced the formula for canonisation: "For the honour of the Blessed Trinity, the exaltation of the Catholic faith and the increase of the Christian life, by the authority of our Lord Jesus Christ, and of the Holy Apostles Peter and Paul, and own, after due deliberation and frequent prayer for divine assistance, and having sought the counsel of many of our brother Bishops, we declare and define Blessed John XXIII [and] John Paul II be Saints and we enrol them among the Saints, decreeing that they are to be venerated as such by the whole Church. In the name of the Father, and of the Son, and of the Holy Spirit. Amen."
This was followed by the presentation to the Pope of the relics of the two saints, one being a phial of the blood of John Paul II, which had been displayed on 1 May 2011, and a piece of skin removed from the body of John XXIII when it was exhumed for his beatification on 3 September 2000.