Catalan emergency officials say 761 people have been injured as police used force to try to block voting in Catalonia's independence referendum.
The Spanish government had pledged to stop a poll that was declared illegal by the country's constitutional court.
Police officers prevented some people from voting, and seized ballot papers and boxes at polling stations.
In the regional capital Barcelona, police used batons and fired rubber bullets during pro-referendum protests.
Speaking soon after the polls closed at 20:00 local time (18:00 GMT), Spanish Prime Minister Mariano Rajoy said Catalans had been fooled into taking part in an illegal vote.
The Spanish interior ministry said 12 police officers had been hurt and three people arrested. It added that 92 polling stations had been closed.
The national police and Guardia Civil - a paramilitary force charged with police duties - were sent into Catalonia in large numbers to prevent the vote from taking place.
While Barcelona Mayor Ada Colau condemned police actions against what she called the region's "defenceless" population, Spain's Deputy Prime Minister Soraya Saenz de Santamaria said police had "acted with professionalism and in a proportionate way".
One voter, Júlia Graell, told the BBC that "police started to kick people, young and old", adding: "Today, I have seen the worst actions that a government can do to the people of its own country."
In Girona, riot police smashed their way into a polling station where Catalan leader Carles Puigdemont was due to vote, and forcibly removed those looking to place their ballots. Mr Puigdemont was able to vote at another polling station.
The BBC's Tom Burridge, in Barcelona, witnessed police being chased away from one polling booth after they had raided it.
Since Friday, thousands of people have occupied schools and other buildings designated as polling stations in order to keep them open.
Many of those inside were parents and their children, who remained in the buildings after the end of lessons on Friday and bedded down in sleeping bags on gym mats.
In some areas, farmers positioned tractors on roads and in front of polling station doors, and school gates were taken away to make it harder for the authorities to seal buildings off. Firefighters acted as human shields between police and demonstrators.
Referendum organisers had called for peaceful resistance to any police action.
Meanwhile, FC Barcelona's match against Las Palmas was played behind closed doors, after Barcelona said the football league refused to suspend the game.
Catalonia, a wealthy region of 7.5 million people in north-eastern Spain, has its own language and culture.
It also has a high degree of autonomy, but is not recognised as a separate nation under the Spanish constitution.
Pressure for a vote on self-determination has grown over the past five years.
But Spanish unionists argue Catalonia already enjoys broad autonomy within Spain, along with other regions like the Basque Country and Galicia.
Mr Rajoy says the vote goes against the constitution, which refers to "the indissoluble unity of the Spanish nation, the common and indivisible homeland of all Spaniards".
Central government spokesman Iñigo Mendez de Vigo accused the Catalan government of being inflexible and one-sided, but it is a charge that Catalan nationalists have thrown back at Madrid itself.
Before the poll, Spanish authorities seized voting materials, imposed fines on top Catalan officials and temporarily detained dozens of politicians.
Police have also occupied the regional government's telecommunications centre.
Spain says a number of factors ensure the poll does not adhere to international standards: the Spanish interior minister said the computer system preventing people from voting twice was not working from Sunday morning.
On top of that, any result would not be legally binding, as the poll had been blocked by the Constitutional Court.
The Spanish government has always said that it's the Spanish courts ordering the Spanish police to act.
But their strategy of physically preventing people from voting has the potential to backfire hugely.
Had you asked me 24 hours ago whether or not I thought it realistic that Catalonia's regional government would declare independence from Spain in the next few days I would have said probably not.
But after the very ugly scenes we've seen across this city and this region today I think it is a very real possibility.