CHARLOTTE, N.C. — As expected, Bank of America Corp. on Tuesday gave investors an historically bad quarterly earnings report.

The Charlotte-based bank said it lost $8.8 billion in the second quarter, as more than $20 billion in previously disclosed mortgage-related charges walloped its bottom line. The loss was the company’s worst ever, but in line with the estimate it gave last month of between $8.6 billion and $9.1 billion.

The red ink demonstrated, once again, that the nation’s biggest bank is laboring to shed mortgage-related troubles inherited from its 2008 Countrywide Financial purchase. A large portion of the mortgage losses stem from an $8.5 billion settlement announced last month over investor claims related to Countrywide loans sold off during the housing boom.

The ongoing mortgage woes have left analysts wondering if the bank has enough capital to absorb future losses and to meet stricter international standards that are being implemented through 2019. In a conference call with analysts, the bank’s executives noted that the company’s capital ratios exceeded estimates outlined last month and listed ways the bank can meet the higher requirements over time.

For these reasons, Bank of America Chief Executive Brian Moynihan said he has confidence that “we don’t need to raise capital,” reiterating previous statements that the bank doesn’t have to issue more shares. Raising capital by selling more stock dilutes the holdings of existing shareholders.

Bank of America’s second-quarter loss compared to a $3.1 billion profit in the second quarter of 2010. Including dividends paid to preferred shareholders, Bank of America posted a loss of $9.1 billion applicable to common shareholders, compared to a gain of $2.8 billion a year ago.

Tuesday’s report also highlighted how banks are struggling to increase revenue in a time of slow economic growth and tighter regulation. The bank’s total revenue slipped to $26.5 billion from about $27 billion in the first quarter and $29 billion a year ago.