Goldman Sachs Group's trading revenue nearly doubled in the huge swings in stock and bond markets in the second quarter.

This helped the US bank soar past estimates for its quarterly profit today. 

Its shares jumped nearly 6% as it posted a 93% surge in revenue in its trading business, including its best results in a decade in both equities and fixed income, commodities and currencies (FICC) trading. 

Unlike bigger rivals JPMorgan and Citigroup, Goldman has minimal exposure to consumer loans that may go bad and is heavily reliant on trading, shielding it somewhat from the economic fallout of Covid-19. 

Goldman used a substantial amount of the money it generated from capital markets to bolster its capital levels and put money aside for possible legal settlements related to the 1MDB scandal. 

Excluding those items, the bank might have earned $11.79 per share, Oppenheimer analyst Chris Kotowski said.

 It reported earnings per share of $6.26 for the second quarter, which was nearly double the average analyst estimate of $3.78, according to the IBES estimate from Refinitiv. 

The results showed the power of Goldman's trading business when times are good, but also raised questions about how the bank might have generated that income in lieu of the recent capital markets boom. 

"The quarter couldn't have come at a better time for Goldman Sachs," Evercore ISI analyst Glenn Schorr said. 

Investment banking revenue, which includes underwriting, jumped 36%, driven primarily by a flurry of initial public offerings (IPOs) during the quarter, as capital markets saw a stunning revival. 

Three of Goldman's four main reporting lines posted higher revenue, with overall revenue jumping by 41% to $13.3 billion and comfortably beating estimates. 

It set aside $1.6 billion for loans that could potentially go bad, up from $937m in the previous quarter. In addition, the bank stashed away an additional $945m for litigation and regulatory proceedings. 

The bank continues to engage in discussions with regulators in the US and Malaysia on possible settlements related to the role it played in the 1MDB sovereign wealth fund scandal. 

Goldman said this increased provision reduced its annualised return on equity by 4.5 percentage points in the second quarter. 

It reported a return on equity (ROE) of 11.1% for the quarter and return on tangible common equity (ROTE) of 11.8%, two key measures of profitability. 

Goldman said in January it aims to deliver a 13% return on equity and over 14% return on tangible equity within the next three years. 

The bank's net earnings applicable to common shareholders rose 2% to $2.25 billion in the quarter ended June 30.

Rival Morgan Stanley reports its quarterly results tomorrow.