They were declared saints by Pope Francis, before a crowd of hundreds of thousands in the Vatican.
Pilgrims and leaders from Latin America were among those who attended the ceremony on Sunday.
Born in Argentina, Pope Francis is the first Latin American to lead the Roman Catholic Church.
In Costa Rica, some 20,000 people assembled in the national stadium for a vigil, which began on Saturday night.
They watched the Sunday-morning Mass in St Peter's Square on big screens in San Jose.
A woman from the Central American nation played a key role in the canonisation of Pope John Paul II.
The Church says Floribeth Mora's life was miraculous saved by the Polish-born Pope.
She had a rare type of brain aneurysm that could not be operated on and says she was cured after praying for the late Pope in 2011.
That was the second miracle required by the Vatican for Pope John Paul to be declared a saint.
Ms Mora was at the ceremony in St Peter's Square.
"God has chosen this very beautiful country to carry out a miracle, something unexplainable," a young Catholic named Carlos Cruz told Reuters.
In Mexico - which was part of Karol Wojtyla's first visit abroad after he became Pope in 1978 - some 1,500 people took part in a vigil in the capital's main cathedral.
"Those of us here have come because of our faith, fervour for Jesus Christ and to ask John Paul II to intercede on our behalf," said Maria Ines Rivera.
Brazil, which has the largest Catholic population in the world, has become the first country to name a church after Saint John Paul II.
The small church, in a poor neighbourhood of Salvador, was opened by the Pope in 1980.
The Mass was attended by Pope Emeritus Benedict, who quit as pope last year, and roughly 100 foreign delegations.
Pope Francis paid tribute to the two new saints as "priests, bishops and popes of the 20th Century".
Relics of each man - a container of blood from John Paul and a piece of skin from John - were placed near the altar.
At the climax of the service, Pope Francis said in Latin: "We declare and define Blessed John XXIII and John Paul II to be saints and we enrol them among the saints, decreeing that they are to be venerated as such by the whole Church."
The Vatican estimated some 800,000 pilgrims had poured into Rome to see the two-hour ceremony first-hand.
"Four popes in one ceremony is a fantastic thing to see and to be at, because it is history being written in our sight," said Polish pilgrim Dawid Halfar.
John Paul II was Pope from 1978 until his death in 2005.
John XXIII was born in the Italian city of Bergamo. He introduced a number of reforms in the Catholic Church during his papacy, between 1958 and 1963.