Bank of America Corp.'s BAC, -0.55% fourth-quarter profit surged sharply, beating analyst estimates, as the banking giant bounced back from a year-ago weighed down by one-time charges, while also benefiting from stronger credit quality.

The bank logged large litigation expenses but benefited from a narrower loss in its consumer real estate division, which includes mortgage banking, even as mortgage originations slowed.

Charlotte-based Bank of America reported a profit of $3.44 billion versus a profit of $732 million for the fourth quarter of 2012, which was weighed down by charges tied to a $11.6 billion settlement with Fannie Mae (FNMA).

On a per-share basis, the bank reported a profit of 29 cents, compared with the 26 cents a share expected by analysts polled by Thomson Reuters. Revenue climbed 15% to $21.49 billion, compared with analysts' expectation of $21.24 billion.

The second-largest U.S. bank by assets has made progress in recent quarters in moving beyond expensive legal woes tied to its 2008 acquisition of home lender Countrywide Financial Corp. But an economy still growing slowly, declining mortgage refinance activity and volatile trading revenue have continued to remain a challenge for banks across the industry, including Bank of America.

The results come as CEO Brian Moynihan looks to methodically build back a financial institution that suffered heavily from past mistakes. Mr. Moynihan has been leading a push for Bank of America to cross-sell various products in areas such as the firm's brokerage division, while making a renewed push into mortgages after the bank backed away from that business somewhat in 2011 and 2012.

Bank of America's consumer real estate division--which includes mortgage banking--reported a loss of $1.06 billion. In the year-earlier quarter and the third quarter, the division reported a net loss of $3.7 billion and $1 billion respectively.

Like peers Wells Fargo & Co. (WFC) and J.P. Morgan Chase & Co. (JPM), Bank of America's results continued to be bolstered by improving credit quality. Credit-loss provisions were $336 million compared with $2.2 billion a year earlier and $296 million in the third quarter.

The reduction in the allowance for loan reserves was $1.2 billion.

For years, Bank of America has been dogged by the aftermath of the mortgage meltdown, mainly losses from soured loans and legal claims from mortgages it or its predecessors sold.

For the fourth quarter, Bank of America's litigation expense was $2.3 billion, compared with $916 million a year earlier and $1.1 billion in the third quarter.

The bank's litigation expense is likely to remain high given ongoing lawsuits like those with the Department of Justice and the Federal Housing Finance Agency, Citigroup analyst Keith Horowitz wrote in a note before Wednesday's earnings.

Subscribe to WSJ: http://online.wsj.com?mod=djnwires