The regulatory environment also played a role in the shift: New rules crimped some of the traditional investment banking practices, or made them more expensive.
In the second quarter, the bank continued to trim back its "value at risk," a way of measuring potential trading losses and the risks that the bank is willing to take. Last year, the wealth management unit brought in more revenue than the investment bank. That's a significant change from earlier years. In 2008, the investment bank made up two-thirds of the company's revenue.
Cutting jobs and other expenses has also been a big part of the bank's strategy to deal with stricter regulation and uncertainty in the economy. Morgan Stanley shed about 3,000 positions, or 5 percent of its workforce, in the last year.
CLSA analyst Mike Mayo said Gorman's performance over the past four years had been mixed, and goals like sewing up the Smith Barney merger had taken longer than investors wanted. Still, he was optimistic about the bank's future, and last year upgraded it from a "sell' to a "buy."
"It's better late than never," Mayo said. "You wouldn't believe how many people I still talk to who say, 'Oh yeah, Morgan Stanley, all the problems.' ... But that's yesterday's news."
He and other analysts described the quarter as improved, though with some reservations.
"They're doing all these things that lay a clearer path to improved returns," said Shannon Stemm, an analyst at Edward Jones in St. Louis. "They still need to get there."
The bank's performance in trading bonds for clients, for example, has been inconsistent.
"We've been through a period where we had to clean up a lot of stuff," Gorman said in response to an analyst's question about the unit.
Financial measures like the return on equity, a gauge of profitability, are still well below where the bank would like them to be. In fact, the board of directors cut Gorman's 2012 pay partly because they were frustrated by the low returns.
The purchase of Smith Barney has been less than seamless. Combining the technology of the two brokerages has been expensive, and some employees have reportedly left over cultural differences. The bank, though, emphasizes that remaining employees are more productive than ever.
The stock buyback was enough to rev up investors on Thursday. When a company buys its own shares, it's a sign that it has confidence in itself and thinks the stock price will go up. The buyback also indicates that the Federal Reserve, which had to give its permission, is happy with Morgan Stanley's capital levels. Morgan Stanley hasn't bought back any of its shares since 2008.
Morgan Stanley earned $898 million in the quarter after excluding the benefit of an accounting gain, more than double the $337 million it made a year earlier.
That worked out to 45 cents a share after stripping out the gain and a charge for the purchase of Smith Barney. Financial analysts polled by FactSet had expected 43 cents. Analysts' expectations generally exclude one-time items.
Revenue totaled $8.3 billion before the accounting gain, up 26 percent from a year earlier. That also beat the $7.9 billion that analysts had expected.
Revenue in the investment bank jumped 40 percent after excluding the accounting gain. The bank traded more stocks on behalf of clients, underwrote more stock and bond offerings and advised more companies on strategy. Revenue from selling and trading bonds for clients also improved.
Other banks have reported strong results in investment banking, helped by surging stocks in late May that drew investors and companies to the market.
Revenue rose 10 percent in the wealth management unit, which advises small and medium-sized businesses and wealthy individuals.
The stock rose 4.4 percent, up $1.16 to close at $27.70 Thursday.