Morgan Stanley stunned Wall Street with better-than-expected second-quarter results, outperforming Goldman Sachs and other rivals as it gained market share in tough trading conditions.

The bottom line was helped by strong equity and sales trading, surprisingly resilient fixed income, currency and commodities trading, and a lead underwriting position on several big technology IPOs. Morgan Stanley shares rose 6.3 percent to $23.09 in morning trading.

The bank appears to have won market share from rivals, most notably Goldman Sachs Group Inc, which posted a 53 percent decline in quarterly FICC trading, compared with Morgan Stanley's 10 percent drop.

We're seeing some progress here on the turnaround in Morgan Stanley's trading business, which has been a long time in the making, said Shannon Stemm, an analyst at Edward Jones.

The bank reported a quarterly loss to common shareholders of $558 million, or 38 cents per share, weighed down by a charge for restructuring some of its preferred stock that amounted to $1.02 per share.

The loss was much smaller than analysts expected. The average Wall Street forecast was a loss of 62 cents a share, according to Thomson Reuters I/B/E/S. In the same quarter a year ago, the bank earned $1.91 billion, or $1.09 a share.

The bank's other businesses also showed gains. Morgan Stanley Smith Barney, a joint venture with Citigroup Inc, contributed $180 million of income to Morgan Stanley, a 64 percent increase from a year earlier. Asset management eked out $19 million of income, compared with a loss of $44 million in the same quarter last year.

Morgan Stanley is the new Goldman Sachs, said Richard Bove, a bank analyst at the brokerage Rochdale Securities. Every one of their divisions shows an improvement, and the improvement in trading operations is especially impressive.

Chief Executive James Gorman has been on an aggressive campaign to increase market share in FICC trading, trying to woo clients away from competitors and get existing customers to trade more on Morgan Stanley's platform. He reinstalled Ken deRegt as head of FICC trading in January to revitalize the business.

Chief Financial Officer Ruth Porat said Morgan Stanley still has work to do in FICC. It's progress against a level that we thought was too low for this franchise, she said.

RARE SYMMETRY

In a rare symmetry, both net revenue and total non-interest expenses at the company grew 17 percent from a year earlier, signaling that Morgan Stanley is keeping its cost growth in check.

Compensation, traditionally the biggest part of an investment bank's expenses, totaled $4.7 billion, or 50 percent of Morgan Stanley's net revenue. That compares with 57 percent in the first quarter and 49 percent a year earlier.

Second-quarter results were boosted by a strong increase in equity sales and trading revenue, up by more than a third from a year ago at $1.9 billion.

FICC trading revenue fell just 10 percent to $2.1 billion. Investment banking revenue -- which includes merger advisory and stock and bond underwriting -- surged 57 percent to $1.7 billion.

Revenues in another key division, wealth management, rose 13 percent, and earnings in that segment rose by almost two-thirds. Morgan Stanley owns a majority stake in its joint venture with Citigroup and plans to acquire the rest of the business over time.

Gorman has targeted a pretax operating margin of 20 percent for the business, but high costs have kept profits in check. The wealth management business posted a 9 percent margin in the second quarter.

On a conference call Thursday, Gorman expressed impatience with the high level of expenses in the wealth management unit. Margins must improve, and do so soon, he said.

Porat said management is cutting lower-performing financial advisers in an effort to trim costs and boost profits. At the end of June, the bank's brokerage force stood at 17,638, down from 18,087 at the end of the first quarter.

The second-quarter loss included a charge of $1.02 per share and a dilution of the bank's share base from the conversion of a $7.8 billion preferred stock investment by Japan's Mitsubishi UFJ Financial Group. The conversion allows Morgan Stanley to avoid expensive dividends to the Japanese bank in the future, and also boosts its common equity capital.

(Reporting by Lauren Tara LaCapra, additional reporting by Svea Herbst and Jed Horowitz, editing by Knut Engelmann and John Wallace)