Profits roared back at the investment bank Morgan Stanley in the fourth quarter, reversing a loss in the same period a year ago, when its results were weighed down by a costly legal settlement.

Earnings increased sharply across the bank’s business lines. Morgan Stanley underwrote more stock and bond offerings and brought in more fees from advising companies on mergers and other deals. Financial advisers in the wealth management unit, who work with individual investors, generated more revenue per worker.

Investment banks like Morgan Stanley have traditionally focused on doing business with companies, governments and other big organizations. But Morgan Stanley has also been expanding its work with individuals, which can provide a steady source of revenue even when financial markets are volatile.

To that end, the bank is in the process of buying back the rest of the Morgan Stanley Smith Barney retail brokerage that it doesn’t already own. Citigroup still owns 35 percent of the unit, and Morgan Stanley says it hopes to buy that stake back this year.

Morgan Stanley earned $867 million after stripping out an accounting charge related to changes in the value of the bank’s own debt. That compares with a loss of $374 million in the same period a year ago.

The loss last year was related to a settlement Morgan Stanley made with the financial insurance company MBIA, which had accused the bank of misleading it about the quality of certain securities for which it bought insurance.

On a per-share basis, Morgan Stanley’s earnings were equivalent to 45 cents, versus a loss of 20 cents per share a year ago. Revenue jumped 37 percent, to $7.5 billion from $5.5 billion.

Morgan Stanley’s stock climbed $1.30 to $22.05 in early trading Thursday, a gain of 6 percent.

CEO James Gorman, in a prepared statement, acknowledged that the year had brought “significant challenges.” The bank was criticized for its handling of Facebook’s glitch-plagued stock market debut, and its credit rating was cut by the ratings agency Moody’s. Gorman said the bank has “reached a pivot point,” however, and is “poised to reach the returns of which it is capable on behalf of our shareholders.”

Morgan Stanley bank is still under pressure to cut jobs and expenses as a way to boost earnings. Over the year, it shed nearly 4,500 jobs, or 7 percent of its workforce. It plans to cut another 1,700 jobs, with cuts focused on the investment bank and senior-ranking employees. It plans to pull back on investment banking in Russia and the Middle East and hold off on expansion plans for other countries, focusing instead on New York, London and Hong Kong.

Bank of America, Citigroup, Goldman Sachs and JPMorgan Chase also trimmed jobs over the year.

Morgan Stanley has also been shaking up how it pays its bankers, a topic that has become a flashpoint in the financial crisis and its aftermath. The Wall Street Journal reported this week that the bank plans to change how bonuses are paid to higher-paid bankers.

Bonuses, which are usually awarded in the first couple months of the year, will be paid in four installments spread over almost three years, instead of one lump sum, the Journal reported. The strategy is one that shareholder activists applaud, saying it encourages bankers not to take unreasonable risks.

The average pay for a Morgan Stanley employee in 2012 was about $274,000, though compensation can vary wildly among employees. The average for Goldman Sachs, Morgan Stanley’s closest competitor, was about $399,000.

The bank didn’t mention a development that’s almost certainly weighing on investors’ minds: Activist hedge fund manager Dan Loeb revealed this month that he had bought a stake in the bank.

Loeb is known for shaking up top management at companies that he deems in need of change, such as Yahoo. In a letter to his investors, Loeb said Morgan Stanley “is in the early innings of a turnaround,” according to published reports of the letter. But he also criticized the bank for how much it pays its board members.

Public companies hire board members to oversee managers on behalf of shareholders. Morgan Stanley paid all of its directors at least $335,000 in 2011, though the bulk of their pay was in the form of stock awards.