"There is no justice in Spain, but luckily there is in Europe," said Delia Esther Molina, 57, an unemployed Cuban who is facing eviction, demonstrating outside the Spanish parliament.
The European Court of Justice ruled that Spanish legislation breached a EU consumer rights directive by preventing courts from halting evictions based on "unfair" mortgage agreements.
The Spanish government promised its law would be "corrected" to comply with the ruling.
The decision by the EU court in Luxembourg gave a fresh boost for a popular protest movement which last month persuaded the Spanish parliament to consider reforms to the eviction laws.
"We are very satisfied," said Ada Colau, a spokeswoman for the Platform for Mortgage Victims (PAH), the organisation that brought that motion backed by 1.4 million signatures.
"This is a big step forward for what we have been campaigning for, over four very hard years," since the worst of Spain's financial crisis broke out, she said.
The Barcelona judge who took the case to the European court, Jose Maria Fernandez Seijo, said that "from now on, any judge who detects abusive clauses can decide as a precaution not to evict the consumer" until he has decided whether the terms of the mortgage are fair.
Campaigners have accused banks of predatory lending during the Spanish construction boom that collapsed in 2008 and of misleading unwitting borrowers.
"I bought my house in 2005. I'm not highly literate, so they really fooled me," said Jorge Teran, an Ecuadoran plumber who lost his job in 2008.
"If they had explained to me the interest rates and everything, I would never have signed."
In a deep recession which has pushed unemployment to record highs of 26 percent, hundreds of thousands of people have defaulted on their loans and been evicted as the banks scramble to get their loans back.
Spain's top legal authority, the General Council of Judicial Power, says 415,000 eviction orders have been issued since 2008, including for second homes, land and commercial property.
Some 60 percent of those evictions have been carried out.
In response to popular protests and a string of reported suicides of people facing eviction, Spain's government in November passed a two-year moratorium on evictions — but campaigners insist it go further.
The activist's bill calls for an end to evictions and for insolvent homeowners to be allowed to write off their debts by surrendering their home.
Under current Spanish law, a bank can pursue a mortgage holder to pay off the rest of a loan if the value of the seized property falls short.
"I want to be able to hand them my home and have them write off the debt," said Molina. "I have nothing."
The group also demands that empty properties held by Spanish banks be transformed into social housing.
Colau said Spain was an "anomaly" in Europe for the harshness of its eviction laws.
"The Spanish exception is over," thanks to Thursday's ruling, she said.
Gonzalo Moliner, chairman of the judicial council, said the change required by the European ruling was "immediately applicable" in Spain.
The head of the Spanish consumers' association Facua, Ruben Sanchez, called it "a turning point in relations between mortgage-holders and the banks".
Beyond the EU court's ruling, PAH activists now demand Spain enshrine the group's demands in new legislation.
"They have to change the law, for all the people like me who were fooled," said Teran.