The looming showdown comes three weeks after jihadist attacks in Barcelona, the capital of Catalonia, and a seaside resort which killed 16 people and wounded more than 120.
"The concept of state and unity of the homeland ... doesn't have a future in modern democratic Europe," said the president of Catalonia, Carles Puigdemont, at the end of his speech late Wednesday after the vote.
Lawmakers approved the bill despite a February ruling by Spain's Constitutional Court declaring it would be unconstitutional.
- Spanish court blocks Catalan indepenedence referendum
- Thousands rally in support of independence bid
- Spain's asks Constitutional Court to block referendum
Shortly after the law was passed Puigdemont and the rest of his cabinet signed a decree calling the referendum, presenting a show of unity in the face of threats of legal action by Madrid, which deems the plebiscite illegal.
Deputy Prime Minister Soraya Saenz de Santamaria said before the law was passed that the government had asked the Constitutional Court to declare "void and without effect the agreements adopted" by the Catalan parliament.
She also denounced the regional assembly's agreement to quickly vote on the bill with little debate as an "act of force" characteristic of "dictatorial regimes".
At the same time, public prosecutors announced they would seek criminal charges for disobedience against the president of the Catalan parliament, Carme Forcadell, and other Catalan officials for allowing the vote on the referendum law.
'Lost all legitimacy'
In a tweet earlier, Forcadell said she had requested that the 12 judges at the Constitutional Court be disqualified, calling them "another extension of the state which has lost all legitimacy".
Most of the court's judges have been nominated by lawmakers from Prime Minister Mariano Rajoy's Popular Party.
Catalonia, a region of 7.5 million people with its own language and culture, accounts for about one-fifth of Spain's economic output, and has significant powers over matters such as education and healthcare.
But Spain's economic worries, coupled with a perception that the region pays more in taxes than it receives in investments and transfers from Madrid, have helped push the cause of secession from the fringes of Catalan politics to centre stage.
Adding to the rise in separatist sentiment was a 2010 ruling by the Constitutional Court striking down parts of a 2006 autonomy charter which granted new powers to Catalonia and recognised it as "a nation".
Lawmakers who back independence won an absolute majority in the 135-seat regional parliament for the first time in a September 2015 election. The government that emerged from that vote vowed to begin the process of breaking away from Spain.
Rajoy responded by promising new investments in Catalonia and regularly sent his deputy to the region, but made no significant reforms regarding the division of powers that addressed Catalan concerns.
Caroline Gray, an expert on Spanish independence movements at Britain's Aston University, said Madrid could have defused the rising separatist tide had it offered Catalonia a new financing deal a few years ago.
"If some sort of deal had happened in the past, I personally think we wouldn't be where we are today," she told AFP.
Opinion polls show that Catalans are evenly divided on independence. But a majority, over 70 percent, want a referendum to take place to settle the matter.
Rajoy steadfastly refuses to let Catalonia hold a plebiscite similar to Scotland's 2014 referendum on independence from Britain, which was approved by London and resulted in a "no" vote.
His Popular Party and the Constitutional Court argue that the Spanish constitution does not allow regions to unilaterally decide on sovereignty.
The Catalan government staged a symbolic independence referendum in 2014, when more than 80 percent of participants voted to split from Spain -- though only 2.3 million of Catalonia's 5.4 million eligible voters took part.
Spain's Court of Auditors ruled Tuesday that 11 former Catalan officials, including former Catalan president Artur Mas, must repay by September 25th the €5.1 million ($6.1 million) in public funds that it cost to hold that vote.
By Daniel Bosque with Daniel Silva in Madrid / AFP