* Ruling may help Spanish bank stocks on Wednesday

* Banking association applauds decision

* Consumer associations call it into question (Adds details)

MADRID, Nov 6 (Reuters) - Spain’s Supreme Court ruled on Tuesday that banks are not required to pay stamp duty on mortgages, sparing them from potentially having to reimburse billions of euros to borrowers who for years have paid the tax themselves.

The decision reverses a ruling in mid-October in which the Supreme Court upset the status quo by declaring that banks, not their customers, were legally responsible for the tax - spelling a potential windfall for borrowers but a big risk for banks which lobbied hard against the change over the past weeks.

The ruling in October called into question a law from two decades ago that stated that customers had to pay stamp duty on mortages.

Though the ruling in October was considered final, a special section of the Supreme Court has been deliberating for the last two days whether to reverse that ruling.

The court said on Tuesday it would publish the entire ruling in the coming days.

Labour minister Magadalena Valerio said the government would respect the judicial resolution.

The Spanish banking association AEB welcomed Tuesday’s ruling, saying it was in line with legal framework in other European countries.

Consumer organisation OCU said the ruling was “embarrassing” and called into question the independence of judiciary.

Another consumer body, Adicae, said it would seek to getting the ruling overturned.

“We will appeal today’s decision before the Spanish or European judicial authorities and expect to go ahead with other class-actions,” Adicae head Manuel Pardos said, noting that the Supreme Court judges were split on the matter, with just 15 voting in favour of the ruling and 13 against.

Spanish bank shares fell sharply after the court’s October decision which analysts and ratings agencies said made banks liable for compensation costs estimated between 600 million euros and more than 15 billion euros ($69 million-$17 billion). ($1 = 0.8756 euros) (Reporting By Jesus Aguado Editing by David Goodman and Robin Pomeroy)