The city of Barcelona passed a law on Friday to curb tourism as visitors have begun to overwhelm the city and anger local residents.

Last year the city’s 1.6 million residents were heavily outnumbered by an estimated 32 million visitors, about half of them day-trippers.

The new law comes after more than 25 years of relentless promotion of the city as a tourist destination, and coincides with a planned “occupation” on Saturday of La Rambla, a street that has come to symbolise what many view as the excessive and unsustainable number of tourists.

The occupation has been organised by the Barcelona Urban Neighbourhood Association, along with more than 40 residents and community associations.

Under the slogan “Barcelona isn’t for sale” the protesters are calling for an end to property speculation, which is pricing residents out of the city, and to low-wage jobs in tourist service industries.

“The tourist and restaurant sector is the worst paid in Barcelona,” says Martí Cusó, a member of one of the community groups, the Neighbourhood Assembly for Sustainable Tourism. “They earn half the average salary.”

The new law, known as the special urban plan for tourist accommodation, seeks to limit the number of beds on offer from hotels and tourist apartments. It imposes a moratorium on building new hotels and a halt in issuing licences for tourist apartments.

However, as a number of projects are already in the pipeline, the plan is not expected to have an impact before 2019.

There are currently 75,000 hotel beds in the city and about 50,000 beds in legal tourist apartments, plus an estimated 50,000 illegal ones. Residents’ associations calculate that some 17,000 flats are now tourist apartments and that the resulting shortage has driven up rents that are now the highest in Spain.

The proposal has met fierce opposition from the tourism industry, which claims the law demonises tourists and says that limiting growth can only hurt an already weak economy in a city where tourism accounts for about 12% of the city’s €72bn (£61bn) GDP, according to figures for 2014.

“The focus of the plan is wrong,” insists Manel Casals, director general of the Barcelona hoteliers association. “Of the 32 million people who visited Barcelona last year, only 8 million stayed in hotels. Twenty-three million were day-trippers who spend very little money in the city. You’re not going to regulate tourism by limiting the number of beds. They’re not regulating tourism, they’re only regulating where people sleep.”

Daniel Pardo, a member of the Neighbourhood Assembly for Sustainable Tourism who describes the group’s negotiations with the city over the plan as “frustrating”, says that while it doesn’t go far enough, it’s a start. “What’s positive is there’s a plan to tackle this problem, however flawed that plan is. No one has even considered doing this until now. Before the only plan was more, more, more.”

In a survey carried out by the city council in October on what residents perceived the city’s biggest problems, tourism was second only to unemployment.

Jordi Ferrer, an economist who specialises in the hotel sector, estimates that the city will face a claim of €400m in compensation for projects paralysed by the moratorium.