Catalan police in anti-riot gear moved in after about 50 protesters sat down on the street to block a convoy of cleaning trucks leaving the Plaza de Cataluna square with remnants of the encampment.
Police, some with plastic shields, were shown on television dragging protesters along the street and swiping with truncheons at activists, who had been chanting: "They shall not pass."
An AFP reporter at the scene saw rubber bullets fired.
The protest blockade was broken up within minutes but about 100 protesters regrouped in the square. They were surrounded by two police cordons blocking hundreds more people from entering from nearby roads.
Demonstrators chanted: "The people, united, will never be defeated!" and "No to violence!"
Cleaning crews with 10 lorries dismantled the last of the tents under police surveillance. Later, police left the square and let thousands of demonstrators flood in but by mid-afternoon only a few hundred remained.
Twelve people were taken to hospital out of a total 121, including 37 police, who were treated for light injuries such as bruises and panic attacks, said a Catalan emergency medical services spokeswoman.
One of the protest groups, Democracia Ya (Democracy Now), condemned the "completely disproportionate, gratuitous violence" in a statement by a spokesman Jon Aguirre Such.
"Their cleaning has washed up blood, people bleeding from the head," said a comment on the Barcelona protest's Twitter account "acampadabcn".
Police said they had to clear the encampment in case Barcelona beat Manchester United in the Champions League football finals in Wembley on Saturday and the square was needed for celebrations.
They also swooped on an encampment in Lleida, in the same northeastern Spanish region of Catalonia, where the Plaza Ricard Vinyes was cleared for possible football celebrations.
"Once the cleaning is finished they can go back but without the tents, knives and potentially dangerous objects," a police spokeswoman said in Barcelona.
It was the first police attempt to clear demonstrators since a nationwide movement against unemployment, welfare cuts and corruption began May 15 and grew in city squares across the country.
The government said protesters at the vanguard in Madrid's Puerta del Sol square could now be targeted.
Interior Minister Alfredo Perez Rubalcaba said he was considering clearing the Madrid square in response to requests for action by the regional government and local businesses.
"I will analyse the situation with the police and we will take a decision," he told a news conference.
Madrid protesters, whose numbers have declined since the peak just before May 22 local elections, say they plan to decide Sunday how to carry on the movement.
The demonstrators, most of them young, are known variously as "the indignant", "M-15" after the birth date of their movement, and "Spanish Revolution".
In the municipal and regional polls, voters punished the ruling Socialist Party for the grim economy and handed a huge victory to the conservative opposition Popular Party.