Catalonia's parliament has voted to declare independence from Spain, shortly before Madrid voted to impose direct rule on the region.
Tens of thousands of independence supporters chanted their joyous support as they gathered near the Catalan parliament in Barcelona.
Watching events from inside on two giant screens, they clapped and shouted "independence" in Catalan.
The motion - boycotted by opposition parties - said Catalonia was an independent, sovereign and social democratic state, and called on other countries and institutions to recognise it.
Not long afterwards, the Spanish senate voted to impose direct rule.
The main secessionist group in Catalonia asked civil servants to respond to orders from Madrid with "peaceful resistance".
Catalan leader Carles Puigdemont urged supporters to "maintain the momentum" in a peaceful way.
But in a sign of the seriousness with which Madrid is taking the vote for independence, Spain's top prosecutor may seek rebellion charges against those responsible for it, a spokesman said.
:: LIVE: Catalan MPs vote to declare independence
Minutes after the vote in Barcelona, Spain's Prime Minister, Mariano Rajoy, called for "calm from all Spaniards".
"The rule of law will restore legality in Catalonia," he tweeted.
Mr Rajoy has called a cabinet meeting for 6pm UK time.
Options open to him include sacking the government in Barcelona and taking direct control of the Catalan police.
Speaking outside the senate, Mr Rajoy said Catalan politicians had done "something that is not possible - declare independence".
The president of the European Council, Donald Tusk, said the EU would continue to deal with Spain only.
"For EU nothing changes," he said.
"Spain remains our only interlocutor. I hope the Spanish government favours force of argument, not argument of force."
Shares in Catalan banks fell after the result of the Barcelona vote became clear.