The Wall Street bank posted a quarterly return-on-equity of 17.5%, its highest since 2010. Investors closely track that figure because it shows how well a bank uses shareholder money to produce profits.

Goldman also boasted record earnings per share, beating analyst expectations by a wide margin. Its performance was driven in large part by a 29% jump in trading revenue, as clients responded to news about the coronavirus pandemic by shifting their portfolios.

While rivals including JPMorgan Chase & Co have also benefited from the markets boom this year, they are far more exposed to vulnerable consumers and businesses suffering from unemployment and pandemic lockdowns. Goldman's consumer bank is relatively tiny.

"Simply stunning results," Credit Suisse analyst Susan Roth Katzke said in a report.

Goldman's shares were up 0.6% by late morning as shares of other big lenders fell.

In the years leading up to the pandemic, Goldman's heavy exposure to trading and lack of exposure to traditional lending was viewed as a problem. The bank is in the middle of a business-model revamp orchestrated by Chief Executive David Solomon that includes building out its consumer bank, called Marcus, and adding services like retail wealth management.

Analysts say that is the right strategy for the long term, but, for now, Goldman's business mix is just right.

"Goldman remains one of our favorite stocks," Oppenheimer analyst Chris Kotowski said. "Its loan portfolio is small and of very high quality compared to those of other large bank holding companies. It has minimal exposure to credit cards and small business, which we see as the biggest COVID-19 risks. But it has upside leverage to more active capital markets."

Goldman's $4.6 billion in quarterly trading revenue included gains across fixed income and equity markets, and a bigger increase than other Wall Street banks. The business accounted for 42% of Goldman's overall revenue, while consumer and wealth management represented 14%.

The bank set aside $278 million to cover loans that go bad, bringing its year-to-date total credit provisions to $2.8 billion. By comparison, traditional rivals JPMorgan, Bank of America Corp and Citigroup Inc have set aside anywhere from $10 billion-20 billion this year.

Goldman's investment banking business also benefited from several high-profile IPOs including Snowflake, Rocket Companies and Dun & Bradstreet during the quarter.

Goldman expects the trends to continue through at least the end of the year, as markets remain volatile and its investment banking backlog has grown, Chief Financial Officer Stephen Scherr said on an analyst call.

"We can count on any number of issues to be the source of some volatility, whether it's the U.S. election, Libor transition, or the trajectory of COVID," he said.

Goldman has also picked up "meaningful" market share across its trading businesses, he said, part of the bank's strategy to target major corporations for hedging, Treasury and risk-management services.

The bank's overall profit nearly doubled $3.5 billion from $1.8 billion a year ago. Earnings per share were a record $9.68, up from $4.79 a year earlier.

Analysts had expected a profit of $5.57 per share, on average, according to the IBES estimate from Refinitiv.

Revenue rose at all four of its business units, with total revenue up 30% to $10.8 billion. That was above the $9.5 billion consensus estimate.

(Reporting by Anirban Sen in Bengaluru and Matt Scuffham in New York; Writing by Lauren Tara LaCapra; Editing by Saumyadeb Chakrabarty and Nick Zieminski)

By Anirban Sen and Matt Scuffham