Parliament in Spain's restive Catalonia region has approved an independence referendum on 1 October which Madrid has vowed to outlaw.
Separatist parties which hold a slim majority backed the referendum bill allowing for a vote on whether the wealthy region should leave Spain.
Prime Minister Mariano Rajoy has asked the constitutional court to nullify it.
He was due to hold an emergency cabinet meeting on Thursday and meet other party leaders.
Image copyrightEPAImage captionCatalan MPs celebrated after the vote
His deputy earlier accused secessionists of trampling on democracy.
Spain's wealthy north-eastern region already has autonomous powers but the regional government says it has popular support for full secession.
The Catalan government has a majority in the regional parliament made up of the separatist Junts pel Si (Together for Yes) coalition and the left-wing CUP party.
Will Catalonia try to secede from Spain this year?
Catalan President Carles Puigdemont signed the bill into local law almost immediately after the vote, when it was adopted with 72 votes in favour and 11 abstentions in the 135-seat chamber in Barcelona.
Unionist MPs from the regional branches of Mr Rajoy's Popular Party (PP), the Socialist Party and the centrist Ciudadanos party had left the chamber in protest before the vote, which followed a marathon debate.
PP members left Spanish and Catalan flags on seats behind them to show their disapproval. However, when an MP from the leftist party Podemos started removing the Spanish ones, she was rebuked by the Speaker, Carme Forcadell.
The decision has plunged Spain into a national crisis only three weeks after jihadist attacks in the heart of Catalonia left 16 people dead and more than 100 others wounded.
Deputy Prime Minister Soraya Sáenz de Santamaría condemned the Catalan leadership for carrying out "an act of force" and for acting more like "dictatorial regimes than a democracy".
The war of words intensified when Catalan President Carles Puigdemont accused her of threatening and insulting all Catalans.
Will the vote go ahead?
The pro-independence Catalan government has been preparing for the 1 October vote for months. In its bill announced on Wednesday it said a Yes vote would be followed within 48 hours by a declaration of independence.
Mr Puigdemont says the smallest of margins above 50% will be enough.
So the Spanish government is doing all it can to prevent the vote from taking place. However, an earlier vote in November 2014 did go ahead even after Spain's constitutional court declared it was not an official referendum.
Was Tuesday's vote legal?
The constitutional court argues that Spain's constitution does not allow regions to unilaterally decide on sovereignty.
Former Catalan leader Artur Mas was barred from office by a court earlier this year for running the 2014 vote.
Under a 2015 law, Spanish public servants can be suspended by the constitutional court if they ignore its rulings. Carles Puigdemont insists his position is governed by Catalan regulations and sees any attempt to suspend him as unacceptable.
Other public servants could also be fined and hit by temporary suspensions if they help run the vote.
Catalan leaders have already acted to replace officials not seen as sufficiently supportive of the vote. The head of the region's Mossos d'Esquadra police force, Albert Batlle, resigned from his post over the summer.
Separatist parties which hold a slim majority backed the referendum bill allowing for a vote on whether the wealthy region should leave Spain.
Prime Minister Mariano Rajoy has asked the constitutional court to nullify it.
He was due to hold an emergency cabinet meeting on Thursday and meet other party leaders.
Image copyrightEPAImage captionCatalan MPs celebrated after the vote
His deputy earlier accused secessionists of trampling on democracy.
Spain's wealthy north-eastern region already has autonomous powers but the regional government says it has popular support for full secession.
The Catalan government has a majority in the regional parliament made up of the separatist Junts pel Si (Together for Yes) coalition and the left-wing CUP party.
Will Catalonia try to secede from Spain this year?
Catalan President Carles Puigdemont signed the bill into local law almost immediately after the vote, when it was adopted with 72 votes in favour and 11 abstentions in the 135-seat chamber in Barcelona.
Unionist MPs from the regional branches of Mr Rajoy's Popular Party (PP), the Socialist Party and the centrist Ciudadanos party had left the chamber in protest before the vote, which followed a marathon debate.
PP members left Spanish and Catalan flags on seats behind them to show their disapproval. However, when an MP from the leftist party Podemos started removing the Spanish ones, she was rebuked by the Speaker, Carme Forcadell.
The decision has plunged Spain into a national crisis only three weeks after jihadist attacks in the heart of Catalonia left 16 people dead and more than 100 others wounded.
Deputy Prime Minister Soraya Sáenz de Santamaría condemned the Catalan leadership for carrying out "an act of force" and for acting more like "dictatorial regimes than a democracy".
The war of words intensified when Catalan President Carles Puigdemont accused her of threatening and insulting all Catalans.
Will the vote go ahead?
The pro-independence Catalan government has been preparing for the 1 October vote for months. In its bill announced on Wednesday it said a Yes vote would be followed within 48 hours by a declaration of independence.
Mr Puigdemont says the smallest of margins above 50% will be enough.
So the Spanish government is doing all it can to prevent the vote from taking place. However, an earlier vote in November 2014 did go ahead even after Spain's constitutional court declared it was not an official referendum.
Was Tuesday's vote legal?
The constitutional court argues that Spain's constitution does not allow regions to unilaterally decide on sovereignty.
Former Catalan leader Artur Mas was barred from office by a court earlier this year for running the 2014 vote.
Under a 2015 law, Spanish public servants can be suspended by the constitutional court if they ignore its rulings. Carles Puigdemont insists his position is governed by Catalan regulations and sees any attempt to suspend him as unacceptable.
Other public servants could also be fined and hit by temporary suspensions if they help run the vote.
Catalan leaders have already acted to replace officials not seen as sufficiently supportive of the vote. The head of the region's Mossos d'Esquadra police force, Albert Batlle, resigned from his post over the summer.