Spanish police used batons and rubber bullets to thwart an independence vote in Catalonia today in a show of force that left hundreds injured, according to Catalan officials, and presented Madrid with a huge challenge to calm tensions in the region.

Catalan officials said over 840 people had been injured in the police crackdown and the Spanish Interior Ministry said 12 police officers had been hurt.

Prime Minister Mariano Rajoy, who had declared the vote illegal, said amid one of Spain's biggest political crises in decades that he would call all-party talks to "reflect on the future", but dialogue over Catalonia would be "within the law".

"We cannot allow that 40 years of harmony is thrown in the air though blackmail of the whole nation," he added. "I hope that now they give up on the path that, as has been seen today, leads to nowhere."

Earlier, the streets of Catalonia, an industrial and tourism powerhouse accounting for a fifth of the economy, erupted into violence as national police burst into polling stations with batons, dragging voters away. The action drew criticism at home and abroad including from Scottish First Minister Nicola Sturgeon and Belgian Premier Charles Michel and British Labour leader Jeremy Corbyn.

"I propose that all political parties with parliamentary representation meet and, together, reflect on the future we all face," Mr Rajoy said in a televised address. However, he kept his firm stance against Catalan independence and praised police.

The referendum has pitched the country into its deepest constitutional crisis in decades and deepened a centuries-old rift between Madrid and Barcelona.

Despite the national police action, some polling stations remained open, especially in areas under the supervision of the Catalan police force which adopted much milder tactics.

"I'm so pleased because despite all the hurdles they've put up, I've managed to vote," said Teresa, a 72-year-old pensioner in Barcelona who had stood in line for six hours to vote.

It was still not known when the results would be announced, a regional government spokesman said, adding it had been a long day and it would be a long count.

Catalan leader Carles Puigdemont originally said that if the ‘yes’ vote won, the Catalan government would declare independence within 48 hours, but regional leaders have since acknowledged Madrid's crackdown has undermined the vote.

However many vote, a ‘yes’ result is likely, given that most of those who support independence were expected to cast ballots while most of those against it were not.

Polls show around 40% of the wealthy northeastern region want independence from Spain although a majority wanted a referendum on the issue.

The ballot will have no legal status as it has been blocked by Spain's Constitutional Court which ruled it at odds with the 1978 constitution that effectively restored democracy in Spain after the dictatorship of General Francisco Franco.

Spain's deputy prime minister said force used by the police had been proportionate.

"The absolute irresponsibility of the regional government has had to be met by the security forces of the state," said Soraya Saenz de Santamaria.