Goldman Sachs Group Inc said on Thursday that quarterly profit surged 79 percent, blowing away expectations of weak results, as the investment bank generated its second-highest revenue ever despite turbulent summer markets.

New York-based Goldman, the largest securities firm by market value, said net income rose to $2.85 billion, or $6.13 a share, in the third quarter ended August 31, from $1.59 billion, or $3.26, a year earlier.

Net revenue rose 63 percent to $12.3 billion even as Goldman recorded $1.71 billion of losses related to leverage loans earmarked for buyouts, or $1.48 billion after netting out gains from hedging. That was partly offset by a $900 million gain related to its sale of wind power company Horizon Energy.

The results exceeded by 40 percent the average analyst forecast of $4.37, according to Reuters Estimates. Shares of Goldman rose 1.7 percent in pre-market electronic trading.

Goldman's results defied market worries that trading and investing businesses were hammered by the meltdown in mortgages and the freeze in corporate lending as risk-averse investors suddenly fled the sidelines.

Instead, the firm had record results in many businesses. Fixed-income and equities trading revenue surged despite what some experts said was one of the most difficult markets in 20 years. Goldman said currency, interest rates and mortgage trading were all higher, and customer activity surged.

Investment banking revenue rose to all-time quarterly highs, as merger advisory fees doubled.

It demonstrates how diverse Goldman is both in terms of its product range as well as its geographic diversity, said Camilla Petersen, analyst covering U.S. financials at Atlantic Equities in London. Who would have thought they would put out $1.4 billion in advisory fees? And their (fixed income trading) business was very strong.

That said, debt underwriting income fell and the firm's backlog of pending banking fees decreased during the quarter.

The results sparkled in comparison to rivals Lehman Brothers Holdings Corp and Morgan Stanley, which reported lower quarterly earnings this week.

Goldman shares fell 12 percent over the past three months amid worries that the credit crunch would fuel losses and drive down earnings. The shares have rebounded in recent weeks as those fears abated.

(Reporting by Joseph Giannone)

(Additional reporting by Dan Wilchins)