New York, 21 September There was gloom but not doom.

Wall Street's first reports since this summer's credit storm revealed extensive damage, but better-than-expected earnings this week from four brokerage firms offered some comfort.

There was clear separation among the investment banks, as Goldman Sachs powered through the turmoil in the credit markets to post a 79% increase in profit on Thursday, its third-best quarter ever. At Bear Stearns, earnings fell 61% on sharp losses related to its hedge funds and exposure to subprime investments.

Third-quarter profit was down 3% at Lehman Brothers and 7% at Morgan Stanley, which reported earlier this week, but at both companies performance was stronger than anticipated.

"Is the glass one-fourth empty or three-quarters full?" asked Michael Mayo, a Deutsche Bank brokerage analyst in New York. "We still think it is more full than empty. It is one more case where the brokers showed their resiliency through a difficult market."

At all the firms, the US fixed-income operations experienced heavy losses from mortgage-related securities and a drop in the value of leveraged loans. Bank-run hedge funds, including Goldman's Global Alpha Fund and two Bear Stearns funds that focused on the credit markets, also struggled. But other units picked up some of the slack with stronger results in equities and commodities trading, investment banking fees, and other activities outside the US.

Wall Street analysts said geography was a crucial differentiator. All but Bear Stearns derive more than half their revenue from outside the US. But trading results perhaps told the story best.

Analysts said Bear Stearns' trading revenue was down 89% from the previous quarter. At Morgan Stanley, it was down 53%; at Lehman, 44%. Goldman, however, posted a gain in trading revenue of 46%. It booked a $900-million gain on the sale of Horizon Wind Energy and bet correctly that prices of mortgage-related securities would fall.

"Goldman must have taken the other side of everybody else's trades," said Brad Hintz, a brokerage analyst at Sanford C. Bernstein & Co. "If you look at its results five years from now, you wouldn't be able to tell there were financial troubles."

All the banks that reported this week said they thought the worst was over. "We are a lot closer to the bottom than we were at the second quarter," said David A. Viniar, Goldman Sachs's chief financial officer, during a conference call.

Viniar said there were early signs that the loan sales market was improving. The global economy seems healthy, he said, and the Federal Reserve's larger-than-expected cut in interest rates this week "certainly left a better tone in all financial markets."

Still, challenges remain. Analysts said once-lucrative operations, like the sales of mortgage securities and other structured products, would be smaller going forward. Investors have turned away from complex securities like collateralized debt obligations, and subprime loan origination will be difficult to restart. Many of the firms, including Lehman, announced layoffs in their units active in those areas.

In addition, the steady stream of investment banking fees is likely to slow. Deal advisory fees helped buoy profit at all the major Wall Street firms this quarter. But much of the business was tied to transactions with private equity firms, which were based on deals made earlier but only recently booked. That revenue is likely to fall off in 2008.

"We were driving down the highway, and we just put on the brakes," said Hintz, the analyst.

Even if the financial markets are stabilizing, the underlying problems from the American housing market persist. Analysts still expect a spike in late payments and foreclosures, causing consumers to lose their homes and mortgage-related securities to go bad.

That would trickle down to investment banks, placing Bear Stearns, which has the greatest orientation toward the US and the mortgage market, at the most risk.