The Swiss parliament's upper house on Thursday backed a Swiss-U.S. tax deal that averted the risk of crippling legal action against UBS but punched a hole in the country's treasured bank secrecy.

The deal is yet to be approved by the parliament's lower house, which will discuss it next week. The chances of full parliamentary backing have improved since Switzerland's largest party, the right-wing SVP, lifted its objections to the agreement in May.

The Swiss upper house also voted on Thursday against allowing a referendum on the deal that would delay the agreement coming into effect by several months.

The United States agreed on August 19, 2009, to drop tax evasion charges against wealth management giant UBS after Berne promised it would disclose to U.S. tax officials bank details of 4,450 U.S. clients of UBS in breach of Swiss bank secrecy laws.

But a Swiss court ruling in January blocked the data transfer, forcing the government to bypass the court ruling with a legal patch that requires parliamentary approval and risks delaying the sharing of the client information beyond a deadline agreed for the end of August.

The U.S. accused UBS of helping rich Americans hide almost $20 billion of untaxed money in secret accounts. The tax probe came while the bank was already weakened by about $50 billion of writedowns on toxic assets during the financial crisis and put its survival at risk.

(Reporting by Catherine Bosley and Lisa Jucca, editing by Will Waterman)