The S&P 500 just hit a fresh all-time high, meaning that the effects of the COVID-19 pandemic on the overall stock market have been erased. However, the financial sector has lagged behind. Although it has rebounded quite a bit since March, the Financial Select Sector SPDR (XLF -0.73%) is still lower by nearly 20% this year.

However, Goldman Sachs (GS -0.87%) has been an outperformer. Its stock has rebounded significantly more than its financial sector peers, and its recent results show why it's a good financial stock to hold if you think the stock market is going to crash again before the pandemic is over.

Looking down Wall Street at the sunrise.

Image source: Getty Images.

Investment banking is crash-resistant

The main reason Goldman Sachs has performed better than most other bank stocks during the pandemic is because of its focus on investment banking. In fact, some of Goldman's key business focuses actually tend to do better during recessions and market crashes.

Some areas in particular that do well in rough times are trading, equity and debt underwriting, and advisory. Volatile markets mean higher trading volumes, which translate to higher fee income. In tough times, companies find themselves needing to raise capital. Mergers and acquisitions and restructurings can become more prevalent.

The proof is in the numbers. While the second quarter of 2020 was abysmal for most U.S. companies, Goldman posted its second-highest quarterly revenue ever. Fixed income and equities trading revenues were their highest in nine and 11 years, respectively (they both surged around the financial crisis years as well). Fixed income trading revenue was more than double what it was in the same quarter last year.

Furthermore, Goldman's equity and debt underwriting revenues were the highest they have ever been. Equity underwriting revenue came in 122% higher than the second quarter of 2019, while debt underwriting revenue "only" rose by 93%.

Goldman is set up for good times and bad

While Goldman's business is certainly resilient in tough times because of its investment banking and trading activities, it is also worth noting that the business also has some components that have tons of room to grow in prosperous economic times.

Wealth management is a good example. As investor portfolios grow, so does the amount of assets Goldman manages, and this leads to higher fee revenue.

Consumer banking is perhaps the most exciting growth area of Goldman's business. In just a few years, Goldman has gone from being strictly an investment bank to having one of the premier high-yield savings and personal loan platforms (Marcus by Goldman Sachs), and has also stormed into the credit card business with its Apple (AAPL -1.32%) Card. But this could be just the beginning. Goldman is reportedly developing an investment platform for everyday investors, and could potentially offer checking accounts, auto loans, mortgages, and more.

I'm talking about the business, not necessarily the stock price

Goldman's business should hold up quite well in the event of another market crash. Its investment banking revenue should help offset any declines in its wealth management or consumer banking businesses.

On the other hand, as the March 2020 market crash showed, even the most resilient stocks aren't immune to panics. Goldman bottomed out at 36% less than its current stock price, so investors shouldn't necessarily expect any different if another crash were to come. However, the resilient nature of Goldman's business should help it rebound more quickly than most, as we've seen in the past few months. Any dips in the stock price could be an attractive buying opportunity.