Goldman Sachs (NYSE:GS) reported its second-quarter earnings on Wednesday, and to say that the results surpassed expectations would be a major understatement.

Goldman's revenue came in $3.5 billion higher than estimates had called for, and the $13.3 billion total represents impressive 41% growth over the same quarter a year ago. In fact, this was the bank's second-highest quarterly revenue ever. And on the bottom line, Goldman earned $6.26 per share, which was more than 65% higher than analysts had been expected. And that's after a build of more than $650 million in the provision for credit losses.

At a time when many investors are worried about the health of the banking industry, Goldman's book value has increased by 4% year to date, and the bank's 11.1% return on equity was a big improvement over the previous quarter.

Man looking at laptop and cheering.

Image source: Getty Images.

Investment banking and trading were the key

Goldman's business performed quite well all around, but the firm's investment banking and trading operations were the big standouts.

On the investment banking front, Goldman generated an all-time high $2.66 billion in revenue, fueled by strong equity and debt underwriting revenue. And on the trading side, which is the largest component of Goldman's business, the bank produced its highest revenue in nine years, including particularly strong performance in equity trading.

When the economy gets rough and the markets become turbulent, it's generally a negative catalyst for the traditional savings and loan side of the banking business. However, volatility typically means an increase in trading volume, as well as in debt and equity issuance as companies raise capital.

Consumer banking continues to grow

The consumer business is another area worth mentioning. Goldman has intensified its push into consumer banking into recent years, following up the impressive launch of its Marcus savings and lending platform with the Apple Card credit card product. And it appears that the business is still thriving -- thanks to the increased U.S. savings rate during the COVID-19 pandemic, Goldman's consumer deposits increased by more than 25% in the second quarter alone to a total of $92 billion.

In a nutshell, while some other bank stocks have reported solid results, Goldman's second quarter was an absolute blowout. Trading revenue may not stay at this elevated level forever, but the numbers just released by the bank are certainly giving investors a sigh of relief.