By Stephen Kalin

Saudi Arabia plans to reopen the two holiest sites in Islam to pilgrims in October, seven months after it suspended visits to prevent the spread of the coronavirus, as it attempts to revive its floundering economy.

The kingdom curtailed visits to the main mosques in Mecca and Medina in March after religious gatherings emerged as major spreaders of the virus in the Middle East and other parts of the world. It also locked down parts of its economy but eased most restrictions in June.

Under new regulations, local and foreign residents of Saudi Arabia will be permitted to enter the Grand Mosque in Mecca and the Prophet's Mosque in Medina for the year-round umrah pilgrimage starting Oct. 4, the interior ministry said late Tuesday.

The capacity of both mosques will initially be limited to 30% and gradually increased to 100% on Nov. 1, when pilgrims from outside the kingdom will also be allowed. Entry to the sites will be controlled via a mobile app, and worshipers will be required to wear face masks and practice social distancing.

Restoring religious tourism, a major source of revenue for the Saudi government, in a phased manner follows a nearly three-month decline in reported infections that prompted authorities last week to begin removing curbs on international travel.

Saudi Arabia's economy has been hit by depressed oil prices while coronavirus measures have hurt its nascent tourism and entertainment sectors. Gross domestic product shrank 1% in the first quarter and the International Monetary Fund expects it to contract 6.8% overall this year.

Authorities have tried to balance curbing the pandemic with protecting the economy and upholding their responsibility as stewards of the Muslim world's most important religious event.

The reopenings come amid a new surge of infections in the region. Iran, Iraq, the United Arab Emirates, Bahrain and Israel have each reported their highest-ever daily increases in infections this month. Israel last week became the world's first developed country to impose a second lockdown, upending the Jewish holidays.

Iran's government canceled the annual gatherings for Arbaeen, one of the most important religious events on the Shiite Muslim calendar. Usually, hundreds of thousands of Iranian pilgrims travel to Iraq for the religious holiday but Iraq has banned foreign pilgrims from entering the country this year.

Europe is also tightening restrictions to curb a new surge of infections after earlier lockdowns were eased. Britain this week announced a series of new restrictions as it tries to quell a second wave, and Spain imposed a partial lockdown in Madrid as it confronts Europe's biggest outbreak.

As Saudi Arabia reopens following a longer shutdown than most of its neighbors, it also faces the challenge of avoiding a resurgence of the disease.

The government fully reopened malls, restaurants and offices in June, even as new daily infections peaked at nearly 5,000. New cases are now hovering around 500 a day. The virus has sickened nearly 331,000 people and killed more than 4,500, making it the second-biggest outbreak in the Middle East after Iran.

Saudi authorities allowed international flights to resume last week, but said that foreigners must test negative for Covid-19 no more than 48 hours before entering and then self-isolate for three days upon arrival.

Mecca and Medina, whose crowded slum areas were completely locked down for weeks at the start of the pandemic, have sustained some of the country's worst outbreaks.

In July, the kingdom hosted a dramatically scaled-down hajj pilgrimage, with worshipers confined to small groups, in contrast with the millions that typically attend one of Islam's most important annual rituals.

Saudi Arabia last month said it would conduct Phase 3 trials of coronavirus vaccine candidates being developed by Russia and China. But local authorities have indicated they are still evaluating safety requirements.

Last week, the U.A.E. became the first country outside China to approve emergency usage of a Chinese vaccine candidate for front-line medical workers, following Phase 3 trials in the Gulf country that lasted less than two months.

The U.A.E. has also begun testing one of the Chinese vaccine candidates in Jordan and Bahrain, whose crown prince is participating in the trial.

--Sune Rasmussen contributed to this article.

Write to Stephen Kalin at stephen.kalin@wsj.com