Bank of America Corp. (NYSE:BAC) said on Wednesday that it earned $2.5 billion in the third quarter, or 20 cents a share, as continuing cost-cutting measures and improved credit quality boosted results.

Analysts polled by Thomson Reuters had expected the company to earn 18 cents a share.

The nation's second-largest bank's revenue slipped to just above $22 billion. A year ago the company earned $340 million, or zero cents per share, on revenue $22.53 billion.

"This quarter, we saw good loan growth, improved credit quality and record deposit balances," Chief Executive Officer Brian Moynihan said in a press release. "Our customers and clients continue to do more business with us."