(Reuters) - Goldman Sachs Group Inc GS.N said on Friday it would take a $5 billion earnings hit in the fourth quarter for the new U.S. tax law, becoming the first major U.S. bank to detail the law's one-time impact on corporate profits held overseas.

Set to take effect on Monday, the sweeping tax code changes enacted a week ago by President Donald Trump were expected to mean short-term pain, but long-term gain for U.S.-based corporations, like Goldman, that do business worldwide.

Like many such companies, Goldman has stored away billions of dollars in profits abroad. It did so under a law that lets multinationals avoid the present 35-percent, U.S. corporate tax rate as long as those profits did not enter the United States.

The new law encourages companies to repatriate those earnings and slaps a mandatory tax on them of 15.5 percent on cash and liquid assets, or 8 percent on illiquid assets, regardless of whether the earnings come home or not.

Scores of large companies, including other big banks such as Citigroup C.N and JPMorgan Chase & Co JPM.N, have socked away an estimated $2.8 trillion overseas in recent years. The one-time tax on those earnings is expected to raise $339 billion in federal revenues over the coming decade, according to the Joint Committee on Taxation (JCT), a nonpartisan research arm of the U.S. Congress.

That will hurt multinationals for a while, but they will have eight years to pay the taxes due. Some other tax breaks for banks will be eliminated or narrowed, under the new law, ranging from limits on deducting interest to curbs on deducting premiums paid to the Federal Deposit Insurance Corp.

Some U.S. financial companies have disclosed hits related to deferred tax assets from losses they suffered during the 2007-2009 financial crisis.

FILE PHOTO: A view of the Goldman Sachs stall on the floor of the New York Stock Exchange July 16, 2013. REUTERS/Brendan McDermid

Citigroup has said it expects as much as a $20 billion charge to earnings for this, while Bank of America BAC.N has detailed a $3 billion charge to fourth-quarter profit.

But these negatives should be more than offset in the long run by other changes under the law, analysts said.

Foremost among these profit-enhancing changes will be a deep cut in the overall U.S. corporate income tax rate to 21 percent from 35 percent. That will cut U.S. corporations’ federal tax bills by more than $1.3 trillion over the next decade, based on JCT research.

WORLDWIDE TO TERRITORIAL

The new law will also shift U.S. corporate taxation to a “territorial” system. Under the present, “worldwide” system, Washington taxes active foreign profits, if they are repatriated, at the same rate as domestic profits.

Under the new territorial system, domestic profits will still be taxed, but profits earned abroad by U.S.-based multinationals, within some limits, will no longer be taxed.

This was expected to reduce federal tax revenues by $224 billion over a decade, the JCT estimates. A collection of new minimum and anti-base erosion taxes will offset those losses, but for the most part, the territorial system represents a major win for corporate lobbyists who have been pursuing such a change for decades.

The new law, passed by Republicans in the U.S. Congress over the united opposition of Democrats, marked Trump’s first significant legislative victory since taking office in January.

Multinationals had pushed for many years for a discounted rate on tax-deferred foreign profits. Under the Republican bill, they finally got it. Analysts expect repatriated earnings to go mostly to stock buybacks and shareholder dividends.

JPMorgan, Wells Fargo WFC.N and Morgan Stanley MS.N did not immediately respond to requests for comments.