MADRID (Reuters) - Spanish banks must repay customers more than 4 billion euros ($4.2 billion) after Europe’s top court overturned on Wednesday a Spanish ruling that capped liabilities relating to a disputed mortgage clause, posing a new challenge to some lenders.

Banks will have to compensate customers for what they lost even before May 2013, when Spain’s Supreme Court declared the mortgages invalid if the terms had not been presented clearly. The home loans had an interest rate that could not fall below a certain level meaning customers missed out when rates dropped beneath this level.

New charges resulting from Wednesday’s ruling by the European Court of Justice could eat into bank earnings, which have already been eroded by record low interest rates and fierce competition for a shrunken loan pool, and encourage more mergers.

Economy Minister Luis de Guindos told reporters on Wednesday the country’s financial system was healthy and could deal with the consequences of the ruling.

Banco Popular POP.MC, the sector's weak link and seen as a potential takeover target, faces about 330 million euros in new charges. Its shares led losses among Spanish banks, falling 6 percent to 0.954 euros.

The ruling also knocked shares in Banco Sabadell SABE.MC, Caixabank, BBVA and Liberbank LBK.MC - the banks most exposed to the "floor clauses," which were introduced as a safety net during the financial crisis.

BBVA BBVA.MC and Caixabank CABK.MC have said it could cost them 1.2 billion euros and 750 million euros respectively.

Most Spanish banks have removed the clauses from their mortgage products since the 2013 Spanish court ruling and already set aside money to cover compensation of around 5 billion euros that the court ruled had been incorrectly charged.

A Bank of Spain source said this could have an additional impact of “slightly more” than 4 billion euros on the country’s banks, in line with analysts’ predictions. Analysts expect an average hit of around 30 basis points on capital ratios.

NO APPEAL

The ruling, unexpected by the banks, is final and cannot be appealed against, an EU court spokeswoman said.

The case first arose after several Spaniards said that banks had hidden the floor clauses in their mortgage contracts. The ECJ ruling could now open the door to 2 million others seeking repayment from banks, consumer lobby group Adicae said.

“It follows that national case law, such as that following from the judgment of 9 May 2013 ... ensures only limited protection for consumers,” the ECJ said in its written ruling. “Such protection is therefore incomplete and insufficient.”

Slideshow ( 3 images )

In response to the ruling, the Spanish banking association said banks were open to renegotiating with clients but they wanted more details to know how to apply the decision under Spanish law. The Socialist party called for moves to be made to enable people to recover their money as quickly as possible.

It is still unclear, however, how the banks will go about repaying customers.

Banco Sabadell, which said its mortgages were still valid as they had been presented clearly, could be liable for new charges worth 490 million euros, according to Deutsche Bank analysts.

Slideshow ( 3 images )

BBVA, Spain’s second largest bank, said the ruling would knock its full-year earnings for 2016 by 404 million euros. BBVA shares were down 1.9 percent by 1300 GMT, while next largest lender Caixabank’s were down 2.5 percent

Smaller lender Liberbank, which in relation to its size is the most affected, is liable for 259 million euros. Banco Santander SAN.MC, Spain's largest bank, was among the least impacted as it did not use mortgage floors.

($1 = 0.9590 euros)