Brazil's Supreme Court has upheld a requirement that all who access Rio de Janeiro's tourist spots starting Friday must have a Covid-19 vaccine certificate.

The mandate also applies for access to other public spaces such as cinemas, theaters, gyms, museums, sports stadiums and conference venues -- but not restaurants, bars or shopping malls.

Foreign visitors are allowed to present an international health pass.

A judge in a lower court had scrapped the measure, calling it tantamount to "health dictatorship."

But federal supreme court justice Luiz Fux reversed that decision on Thursday night, arguing that the efforts to combat the pandemic, such as the health pass, are the responsibility of the mayor's office.

"This is a tourist city that wants to celebrate New Year's, carnival and summer with its hotels full," said Rio Mayor Eduardo Paes, welcoming the court ruling.

"By the second half of November, almost 100 percent of (Rio residents) will have taken the second dose.... With the passport we want to tell the responsible tourist who was vaccinated: 'Come without worry.'"

And to those who are unvaccinated, Paes offered a blunt message: "Please don't come, you will not be welcome in Rio de Janeiro."

The city of 6.8 million people famous for its beautiful beaches and breathtaking views has seen a surge of coronavirus infections recently because of the Delta variant.

Rio is betting on widespread vaccination to bring back beloved events such as its annual carnival, the world's largest, which had to be canceled this year because of the pandemic.

Brazil, a country of 213 million people, has registered nearly 600,000 Covid-19 deaths, a toll second only to the United States.

Rio has a reported coronavirus death rate of 439 per 100,000 inhabitants -- far higher than the national average of 280.

Brazil had a late start with coronavirus vaccination but is now the country with the fourth-most doses administered.

Nearly two-thirds of the population have received at least one vaccine dose, and 35 percent are fully immunized. In Rio, that figure is nearly 50 percent.