At least seven people have been injured as authorities ousted squatters from an abandoned building and shacks surrounding it just steps from Rio's iconic Maracana stadium.

With the start of the World Cup two months away, Brazil has stepped up security efforts in the metropolis.

Tens of thousands of football fans will fly in for the tournament and which will stage seven matches, including the 13 July final at Maracana.

At dawn, more than 1,600 heavily armoured police arrived at the abandoned building near the stadium.

The building had been occupied by squatters in recent weeks brandishing an eviction order requested by the Oi phone company, which owns the property.

Cranes and tractors demolished wooden huts built around the building -- many still full of the belongings residents had had no time to pack.

Hundreds of desperate and angry residents and neighbours poured into the street protesting the loss of their new homes.
"This is what happens in the (World) Cup country," was a repeatedly heard lament.

Dozens of furious youths threw stones and bottles at police, who responded with tear gas and rubber bullets. Several buses were set on fire. 

Most residents were dispersed within minutes, but about a hundred protesters resisted police orders to vacate the building for several hours. Two were ultimately arrested for refusing to leave.

The newspaper O Globo also reported that suspected drug traffickers from neighbouring favelas fired guns at the police.

The official tally from civil defence authorities was seven injured, none seriously. But media reports put the figure higher, at 19, of whom 12 were police.

The confusion and violence later spread to neighbouring favelas, where a police car and several buses and trucks were burned, and banks and supermarkets were looted. 

In all, police said they had arrested 22 people for the unrest, including 10 who did not live in the shantytown but participated in the later destruction.

Meanwhile, on-edge police officers hit a pedestrian with pepper spray, and then when witnesses protested he had not done anything to provoke the spraying, another officer pulled a gun but fired no shots.

The shanty town emerged on 31 March when about 5,000 people who were homeless or tired of paying high rents in other slums decided to commandeer the building.

The building had been empty for years, and the surrounding area, where they quickly built makeshift homes.