Bank of America (BAC) notched a surprise break-even profit for the third quarter on Wednesday as the banking giant overcame hefty charges and slumping revenue.

Shares of the No. 2 U.S. bank by assets had a muted response to the stronger-than-expected results, ticking just slightly higher.

Charlotte-based BofA said it earned $340 million last quarter, compared with a profit of $6.23 billion, a year earlier. On a per-share basis, the company earned less than a penny, compared with a profit of 56 cents a share in the year-earlier period. Analysts had called for a loss of 7 cents a share.

Revenue slumped 28% to $20.43 billion, trailing the Street’s view of $20.43 billion.

"Our strategy is taking hold even as we work through a challenging economy and continue to clean up legacy issues,” CEO Brian Moynihan said in a statement.

BofA’s results were hampered by a slew of litigation charges, including $1.6 billion to cover part of the $2.43 billion settlement tied to its sloppy acquisition of Merrill Lynch. Also, the company took charges of $800 million tied to the repricing of certain deferred tax assets due to a cut in the U.K. corporate tax rate and $1.9 billion related to the value of the company’s debt.

In a sign of improved credit quality, BofA said its credit-loss provisions tumbled to $1.77 billion last quarter, compared with $3.41 billion the year before and flat with the second quarter.

BofA booked a net loss of $359 million in its global markets division, compared with a loss of $553 million the year before. Excluding the debt valuation losses and impact of the U.K. tax change, net income rose to $789 million from $560 million in the year before period.

BofA also said it continues to bolster its balance sheet: Basel 3 Tier 1 common capital ratio rose to 8.97% from 7.95% at the end of the second quarter.

Shares of BofA inched up 0.11% to $9.47 in premarket trading. So far this year BofA has narrowly outperformed the broader markets, rising 18%, compared with 16% for the S&P 500.

The results come days after Citigroup (C) disclosed an 88% plunge in third-quarter earnings tied to charges and changes in the valuation of its debt.

Morgan Stanley (MS) is scheduled to release its third-quarter results on Thursday.

Follow Matt Egan on Twitter @MattMEgan5