Catalonia's ruling coalition has vowed to declare independence "immediately" if a majority of voters back it in an October referendum.
Secessionists in the north-east region have long argued that it should break away from Spain.
They argue that the prosperous region, which includes tourist hub Barcelona, pays more to Madrid than it gets back.
Catalonia is one of Spain's richest regions, both culturally and industrially.
It also boasts its own distinct language - Catalan - and centuries-old customs.
There was little support for full independence until the past few years. The mood changed after Spain's painful economic crunch and after a 2010 decision by Spain's constitutional court to water down a charter that gave Catalonia sweeping powers.
The question put to voters in October will be: "Do you want Catalonia to be an independent state in the form of a republic?"
The poll is being compared to the 2014 Scottish referendum on membership of the UK, which saw Scots vote No to independence by 55% to 45%.
But that vote had the blessing of Westminster - while the Spanish government is fighting this one at every turn.
What happens now?
This is a new clash between Madrid and Catalonia's ruling coalition, which stand on different sides of the poll debate.
In his televised New Year's speech, Catalan President Carles Puigdemont promised a "legal and binding" independence vote.
But Madrid sees that as a threat to Spain's national unity, and Prime Minister Mariano Rajoy has called in lawyers to block it.
The country's Constitutional Court has already quashed a resolution approved by Catalonia's parliament calling for the referendum to take place.
Spain has also threatened elected officials with legal consequences if they arrange to hold a vote.
Now Catalonia has introduced a law intended to extract the region from Spain's legal system, in a bid to circumvent such challenges.
The reform will be put to the regional parliament in August.
Xavier Garcia Albiol, the head of Prime Minister Mariano Rajoy's conservative Popular Party in Catalonia, has branded it "a coup d'etat dressed up as democracy".
The region's leading newspaper La Vanguardia said the terms of the vote would allow for independence "within 48 hours" if the vote was in favour.
As per Article 4 of the text, there is no minimum turnout required for the vote to be treated as valid.
How have past votes gone down?
In November 2014, the regional government held an unofficial poll. Some 80% of those who voted backed independence.
However, that ballot was based on a relatively low turnout of 2.2 million voters out of a potential 6.3 million.
It was also non-binding, as the Constitutional Court had ruled it illegal.
It is unclear what the turnout might be in October if Madrid does not authorise the referendum.
Regional leaders including Artur Mas, the former President of Catalonia, were convicted of disobeying the Spanish judiciary by holding the 2014 vote, and barred from public office.
Nonetheless, separatists saw the result as proof of a sea-change.
In 2015, Catalan nationalist parties won an absolute majority in the 135-seat regional assembly and voted to start the process towards independence.
Could Catalonia break away?
A recent poll by the regional government found that Catalans were evenly split on the merits of autonomy, with 48.5% opposing it and 44.3% in favour.
A poll published by the Barcelona-based newspaper El Periodico, not seen as backing independence, suggested that 85% now want a referendum.
Both the PP and the Socialists (PSOE), who came first and second in Spain's general election, oppose Catalan secession.
Prime Minister Mr Rajoy has promised he "won't allow a single act that could harm the unity and sovereignty of Spain".
No surprise, perhaps, as Catalonia makes up 16% of the country's population and accounts for almost 19% of national GDP.
Catalan president Mr Puigdemont is equally adamant that an independent state can, and must, come soon.
But at this point, the Catalan executive has no regional election authority to oversee its proposed vote - and has failed to find a company willing to provide ballot boxes.
The months leading to October look set to be especially turbulent for the Catalan independence movement - and the forces determined to keep it in check.
Correction 22 August 2017: This article has been amended to give more detail on the background to support for full Catalan independence.