Three weeks ago, it was reported that Goldman Sachs (NYSE:GS) was on track to pay its employees the biggest bonuses ever, corresponding with what was shaping up to be the best quarter in the investment bank's history.

And that it was. Net income for the second quarter came in at $3.4 billion, or $4.93 per share on record revenue of $13.8 billion. Without a $426 million dividend paid to taxpayers for the $10 billion TARP payment (which has since been repaid), Goldman would have earned $5.71 per share -- up 25% from the year before.

Record results might seem odd just nine months after Wall Street bit the dust. But the reason Goldman has turned into such a rainmaker is, ironically, precisely because of both Wall Street's and the economy's collapse.

The bulk of Goldman's earnings came from a) divisions with much less competition now that Bear Stearns, Lehman Brothers, and armies of hedge funds have died, and b) divisions that help other companies raise debt and equity to make it through the economic downturn. Have a look:  

Division

Net Revenue

Change (YOY)

Equity Underwriting

$736 million

19%

Debt Underwriting

$336 million

25%

Fixed Income, Currency, and Commodities

$6.8 billion

186%

Investment Banking Advisory (mergers and acquisitions)

$368 million

(54%)

Total Trading and Principal Investments*

$10.8 billion

93%

*Houses fixed income, currency, and commodities division.

The big standout -- fixed income, currency, and commodities -- is blowing up not only from less competition, but a steep yield curve thanks to low interest rates and continued volatility in debt markets. This isn't unique to Goldman. Last quarter, JPMorgan Chase (NYSE:JPM) and Citigroup (NYSE:C) both had big quarters in fixed-income trading as well.

The other moneymakers, equity and debt underwriting, have the wind behind their backs as companies from all industries exploited market optimism to raise capital in the second quarter. After markets rebounded in March, everyone from Bank of America (NYSE:BAC) to Microsoft (NASDAQ:MSFT) lined up at investment banks' doors, begging to raise capital while they could. All of this underwriting translates to big investment banking fees.

This is all great news for Goldman -- and will likely spill over to Morgan Stanley (NYSE:MS) when it reports next week -- but we have to ask how sustainable these record earnings are. Credit spreads will eventually retract, companies will stop issuing one-time equity boosts, and competition will return. Ultimately, that could make Goldman's blowout earnings look more like a one-off event than a permanent return to greatness.

But for now, Goldman is minting money. Enjoy it while it lasts.

For related Foolishness:

Fool contributor Morgan Housel doesn't own shares in any of the companies mentioned in this article. Microsoft is a Motley Fool Inside Value recommendation. The Fool has a disclosure policy.