Morgan Stanley reported better-than-expected sales and a smaller-than-expected loss in its second quarter Thursday, posting a loss of 38 cents a share on sales of $9.3 billion.

The $9.3 billion in revenue marks a 17% improvement from the year-ago quarter when it returned a profit of $1.09 a share on sales of $7.96 billion.

Analysts were expecting a loss of 62 cents a share in the quarter, according to Thomson Reuters, and sales of just over $8 billion.

The 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.

Morgan Stanley (NYSE: MS) shares rallied up $1.24 a share, or 6%, to $22.96 in early trading Thursday.

"While global markets remained challenging this quarter, the firm delivered higher year-over-year revenues across our three major business segments," CEO James Gorman said in a statement.  "With this additional capital cushion and the clear momentum across our main businesses, we are well positioned to help our clients navigate the constantly changing markets and create additional value for our shareholders."

Some of the key highlights from Morgan Stanley's second quarter:

-- Average FA productivity of $785,000 – up 2% from 1Q11 and up 16% from 2Q10.

-- FA headcount of 17,638 – down 162 from 1Q11 as we continued to prune underperformers

-- Positive net new assets of $2.9 billion, representing an $8.4 billion turnaround from 2Q10, which had net asset outflow of $5.5 billion.

-- Net new flows into fee-based accounts of $9.7 billion.  Fee-based assets account for 30% of total client assets of $1.7 trillion, and now surpass half-a-trillion dollars ($509 billion)