The case raises doubt about the future of the effort to identify U.S. citizens who might have hidden billions of dollars in UBS bank accounts to avoid taxes.
Switzerland's laws give bank account holders protection against outside scrutiny, and UBS's agreement to give names to the United States was a notable departure from that tradition.
A Swiss administrative court ruled on Friday that an agreement on double taxation with the United States only allows for data to be disclosed in cases of fraud or the like.
The decision means that the United States might not get details that it wants on 4,450 UBS clients, lawyers said.
The Swiss courts are now one-upping the U.S., said Bryan Skarlatos, an attorney for wealthy clients, many of whom have sought amnesty with the IRS. The question is, how will the UBS commitment to turn over 4,450 names be fulfilled if these types of taxpayers cannot be turned over under the treaty.
U.S. tax authorities said they expect Switzerland to honor the deal, which strained relations between the countries last year. UBS was supposed to give names to Switzerland, which would evaluate them and turn over to the United States.
The United States said it would withdraw its legal summons seeking names if it got 10,000 UBS account holder names.
It is unclear whether that criteria has been met. A separate IRS amnesty program has yielded 14,700 names that U.S. tax authorities are culling.
The Swiss cabinet will discuss next Wednesday how to ensure the implementation of the Swiss-U.S. tax agreement following the court's decision, it said in a statement.
UBS acknowledged the court decision, but did not comment.
In the case decided on Friday, the client failed to file a tax form, but this did not constitute fraudulent behavior even if large sums of money were involved, the court ruled.
The Swiss tax department would have the opportunity to appeal. A further 25 similar cases were still pending.
The question of whether the Swiss-U.S. agreement is in danger is an open one, court spokesman Andrea Arcidiacono said. It is up to the agreement's parties how to proceed.
DOUBTS ON THE DEAL
Switzerland might not have to give up accounts of people who failed to give proper documentation, but did not act fraudulently, said Scott Michel, a lawyer who represents wealthy clients. Many have turned themselves in under the IRS's voluntary disclosure program.
Most of the people whose accounts would be handed over to the United States were suspected of fraud, not simple tax evasion, the Swiss justice department said in November.
The department said it would give the names of American UBS clients with accounts holding more than 1 million Swiss francs ($986,200) where there was reasonable suspicion of tax fraud.
Accounts as low as 100,000 Swiss francs could be included if authorities detected a scheme of lies.
The country would also give the names of U.S. citizens with offshore company accounts with UBS if they were suspected of tax fraud or similar, regardless of where they live.
UBS shares closed down 3.9 percent against a 2 percent dip in the DJ Stoxx European banks index <.SX7P> and a 6.4 percent fall in rival Credit Suisse after U.S. President Barack Obama proposed restrictions on how banks operate.
Swiss financial watchdog FINMA has appealed against a court ruling that it broke Swiss law last year when it ordered UBS to hand over tax-sensitive data of nearly 300 clients to U.S. authorities in an unconnected case.
FINMA's decision was a prelude to the Swiss government bowing to international pressure on tax havens and agreeing to soften its cherished bank secrecy laws in March, a competitive advantage for the Alpine country's banks.
(Additional reporting by Oliver Hirt and Lisa Jucca in Zurich; Editing by Greg Mahlich and Robert MacMillan)
(Reporting by Jason Rhodes in Zurich and Kim Dixon in Washington)