* Court identifies lack of transparency in IRPH contracts

* Decision is seen as a relief for Spanish banks

* Consumer group accuses court of protecting banks

MADRID, Oct 21 (Reuters) - In a boost for Spain's banks, the Supreme Court said on Wednesday a mortgage pricing index used during the country's property crisis was valid and did not constitute market abuse, although there was a lack of transparency in some contracts.

The long-awaited ruling, similar to the court's first decision in 2017, spares Spanish banks from a worst-case scenario that could have cost them billions in compensation, just as they are struggling with the economic impact of the COVID-19 pandemic and ultra low interest rates.

The ruling followed a European Court of Justice (ECJ) decision to send the dispute back to national courts, opening the way for individual claims.

Hundreds of thousands of home loans were sold in Spain, mainly in 2007 and 2008, based on the IRPH index at interest rates that tended to be higher than interbank benchmark rate Euribor.

The Supreme Court, which will publish the ruling in the coming days, said in statement that in four of the five IRPH cases it analysed there was no abuse, even though failure to report the index's evolution showed a lack of transparency.

It will deliberate on a fifth, slightly different case - related to social housing - later on Wednesday, it said.

Spain's listed banks still hold around 14 billion euros ($16.6 billion) of these mortgages, with Caixabank and Bankia - which are in the process of merging - accounting for around half.

Shares in Bankia rose after the ruling but later pared gains. Caixabank was down 0.4%.

"In principle, the news is positive as you take pressure off the sector. Lenders will have less pressure to return any interest earned from the IRPH contracts to customers," said Nuria Alvarez, analyst at Madrid-based brokerage Renta 4.

Most Spanish banks have not set aside any specific provisions over the case.

Though there are no official figures for how many mortgages were sold using the IRPH, Spanish consumer association Asufin estimates around one million people were affected.

Consumer association 'IRPH Stop Gipuzkoa' said the court was trying to protect banks and added that "bottom line, to no one's surprise, it has not found abuse".

The court had ruled in 2017 that the index did not constitute a market abuse, but customers and lower courts challenged that decision at the ECJ.

Even after March's ECJ decision there have rulings in favour and against customers, prompting the Supreme Court to update guidelines which apply to all lower courts.

($1 = 0.8582 euros) (Reporting by Jesús Aguado; additional reporting by Emma Pinedo, editing by Andrei Khalip and Mark Potter)