Tue, 25 Sep 2012 20:13 UTC
The clashes broke out as protesters tried to tear down barriers blocking access to the parliament in Madrid.
Spanish media reported that at least 20 people had been arrested and more than a dozen injured. The protesters dispersed after MPs left the building.
The "Occupy Congress" protest came as the government prepares to unveil further austerity measures on Thursday.
It is attempting to shrink its budget deficit, with the country in its second recession in three years and unemployment near 25%.
The government will unveil the draft budget for 2013 on Thursday and is expected to present new cost-saving reforms to reassure lenders about the state of the country's public finances.
The demonstrators - known as Indignants - say "Occupy Congress" is a protest against the kidnapping of democracy.
Thousands of people massed in Plaza de Neptuno square in central Madrid for the march on parliament.
But their route towards the parliament building's main entrance was blocked off by metal railings, police vans and hundreds of Spanish riot police.
I've been to countless demonstrations in recent months. This was not the biggest but it was one of the most tense.
The fact that it was organised via social media meant that, as a proportion, there were many more young people in the crowd.
The heavy-handed tactics of the Spanish police, with little provocation, perhaps show that the authorities were worried that this could have escalated.
The scuffles tonight in Madrid will make relatively dramatic images on television. Spain is still a place of mainly peaceful protest, even in the face of deep austerity. However tonight shows that even here, there is the potential for some, albeit for now limited, social unrest.
Mark Smith, who lives near the site of the protest, said: "I saw riot police with their batons charging at protesters trying to split up the crowd."
By late on Wednesday night, the majority of the protesters had dispersed peacefully.
Tuesday's demonstration was organised via social media sites and many young people turned out, says the BBC's Tom Burridge in Madrid - but the protest's public profile meant the police were ready for them.
The police's tactics seem to have been to target ringleaders to break up the crowds, adds our correspondent, which prompted some scuffles but no widespread fighting.
Buses had reportedly been laid on to ferry demonstrators into the capital from the provinces.
One of the main protest groups, Coordinadora #25S, said the Indignants did not plan to storm parliament, only to march around it.
The Coordinadora #25S manifesto reads: "Democracy has been kidnapped. On 25 September we are going to save it."
Pablo Mendez, an activist from the 15M Indignants movement, told the Associated Press: "This is just a powerful signal that we are sending to politicians to let them know that the Spanish bailout is suicide and we don't agree with it, and we will try to prevent it happening."
Another demonstrator, Montse Puigdavall, said: "I'm here because of the situation we are living in now, because of all the social cuts and rights that we have lost, that took a lot of hard work to achieve.
"So we are here because we're determined not to lose them."
Under Spanish law, people who lead demonstrations outside parliament that disrupt its business while it is in session may be jailed for up to one year, AFP says.
Clashes have broken out at previous rallies and marches against the cuts and at least 1,300 police were said to be on duty at the Congress building.
Spain's provinces have piled pressure on the government with a possible new bailout request and an early election.
Andalucia is considering asking for a 4.9bn euro (£3.9bn; $6.3bn) emergency credit line from the central government, a spokeswoman for the regional administration confirmed to Reuters news agency.
Three other regions - Catalonia, Valencia and Murcia - have already said they will seek emergency funds.
In Catalonia, President Artur Mas called an early election for 25 November, which correspondents say will be a de facto referendum on his demands for greater independence for the province.
There is real concern in Europe that Spain may need an international bailout going beyond the 100bn euros (£80bn; $125bn) pledged by eurozone finance ministers in June to rescue its banks.
The Spanish government is having to borrow heavily to cope with the effects of a collapse in property prices, a recession and the worst unemployment rate in the eurozone.
After nine months in government, Prime Minister Mariano Rajoy is still resisting pressure to request a bailout.
His government insists the 100bn-euro pledge does not constitute an international financial rescue.
If Mr Rajoy does request a bailout, it may not happen before late October because of a regional election in his home province, Galicia.
Catalonia's election decision comes days after Mr Rajoy rejected a request from the wealthy but indebted region to run its own fiscal affairs.
The region is legally barred from holding an actual referendum on independence.
"It is time to take the risk," Mr Mas told the regional parliament. "If Catalonia were a state we would be among the 50 biggest exporting countries in the world."
In pictures: Madrid clashes