Hosting the pilgrimage is a matter of prestige and a powerful source of political legitimacy for Saudi rulers, the custodians of Islam's holiest sites.
Barring overseas pilgrims for the past two years had caused deep disappointment among Muslims worldwide, who typically save for years to take part.
The hajj, which costs at least $5,000 per person, and umrah pilgrimages that occur at other times of the year are a major engine of Saudi Arabia's tourism sector.
In normal times, they generate about $12 billion annually, keeping the economy humming in Mecca.
After the stoning ritual, pilgrims return to the Grand Mosque in Mecca to perform a final "tawaf", or circling of the Kaaba, the cubic structure that is the focal point of Islam.
Eid al-Adha, the feast of the sacrifice that begins on Saturday, marks the end of hajj.
Muslims across the world buy livestock for slaughter to commemorate the willingness of Ibrahim to sacrifice his son to show obedience to Allah.
On Friday, huge crowds of robed Muslim pilgrims prayed on Mount Arafat, the climax of the annual pilgrimage.
Groups of worshippers, many holding umbrellas against the fierce sun, recited verses from the Koran on the rocky rise where the Prophet Mohammed is believed to have given his final sermon.
After sunset, they travelled the short distance to Muzdalifah, where they slept under the stars before performing the stoning ritual.
COVID FEARS
The large crowds have spurred fears that Covid will spread, especially after many pilgrims remained maskless, despite claims by Saudi authorities that masks would be mandatory.
The hajj has been taking place against the backdrop of a resurgence of cases in the region, with some Gulf countries tightening restrictions to keep outbreaks in check.
All participants were required to submit proof of vaccination and negative PCR tests.
Since the start of the pandemic, Saudi Arabia has registered more than 795,000 coronavirus cases, over 9,000 of them fatal. Some 67 million vaccine doses have been administered in the country of over 34 million people.
The hajj, whose timing is determined by the lunar Islamic calendar, can be physically draining even in ideal conditions, but worshippers this year faced an added challenge: scorching sun and temperatures climbing to 44 degrees Celsius (111 Fahrenheit).