Richard Drew, File, Associated Press
FILE - In this Oct. 16, 2014, file photo, a screen at a trading post on the floor of the New York Stock Exchange is juxtaposed with the Goldman Sachs booth. The Goldman Sachs Group Inc. reports financial results Tuesday, July 19, 2016.

NEW YORK — Goldman Sachs' earnings jumped 78 percent from a year ago as the bank's legal expenses declined and its trading desks saw a surge of activity during Britain's vote to leave the European Union.

The investment bank said Tuesday it had a second-quarter profit of $1.63 billion after dividends to preferred shareholders, or $3.72 per share, up from $916 million, or $1.98 per share, in the same period a year ago.

The results easily topped analysts' expectations, with analysts looking for $3.09 per share.

"Despite the uncertainty created by Brexit, we achieved solid results by continuing to serve our clients across our diversified franchise and by managing our business efficiently," CEO Lloyd Blankfein said in prepared remarks.

Goldman's results last year were impacted by significant legal expenses as the bank settled with state and federal regulators over its role in the housing bubble and subsequent financial crisis.

Echoing the other banks that have reported this quarter, Goldman did well in trading. Goldman's fixed income, currency and commodities division had net revenue of $1.93 billion, up 20 percent from a year ago. Stock trading didn't do as well. Revenue there fell 12 percent to $1.75 billion due to slower trading, particularly in Asia.

Investment banking revenue fell 11 percent to $1.79 billion, reflecting a slowdown in deals. Many companies held off doing deals last quarter due to uncertainty around the British vote. Goldman said its transaction backlog fell in the quarter.

Goldman set aside $3.33 billion to pay its employees in the quarter, down 13 percent from a year ago.

The investment bank posted revenue of $7.93 billion in the period, also beating estimates.

Goldman Sachs shares have fallen 9 percent since the beginning of the year, while the Standard & Poor's 500 index has increased 6 percent. The stock has dropped 23 percent in the last 12 months.