The agreement came as Hillary Clinton, the US secretary of state, held talks with Micheline Calmy-Rey, Switzerland's foreign minister, on the UBS case in Washington.
"There's been an agreement in principle … Our governments have worked very hard on this to reach this point," Clinton said, without giving any further details of the deal.
Calmy-Rey said she was "very satisfied" with the deal.
The US case against UBS was launched in an attempt to get the names of about 52,000 US citizens suspected of storing a total of $15bn in assets in UBS accounts.
The Internal Revenue Service, the US tax office, had called on Gold to order UBS to give them a list of all American depositors so that it can collect due taxes.
The IRS would then turn the names over to the US justice department so that it could launch criminal proceedings against anyone suspected of tax evasion.
But UBS and the Swiss government had said that revealing the names would have involved breaking Swiss law.
The Zurich-based bank admitted to the US justice department earlier this year that it had helped US citizens avoid paying domestic taxes by allowing them to make deposits.
UBS disclosed the names of about 300 US clients and paid a $780m penalty as part of a deferred prosecution agreement, but the IRS then filed a case to get the list of 52,000 other US citizens suspected of storing money at the bank.
Three UBS clients whose names were given to US authorities under the agreement with the US justice department have pleaded guilty to tax evasion charges in federal court.