Bank of America Corp posted a third-quarter profit on Tuesday, helped by accounting gains and asset sales, but the bank's main businesses showed signs of weakness as lending profits dropped and expenses rose.

The bank also slipped to No. 2 among U.S. bank ranked by assets, ceding the top spot to JPMorgan Chase & Co. Bank of America shares fell 3 percent in premarket trading.

The accounting gains and asset sales offset a 15 percent drop in loan income in the latest quarter.

The headline numbers are dramatically different than reality, said Matt McCormick, portfolio manager at Bahl & Gaynor Investment Counsel. I think it would have been flat at best without the adjustments. Revenue was particularly weak.

Bank of America said net income for shareholders was $5.9 billion, or 56 cents a share, in the third quarter, compared with a loss of $7.6 billion, or 77 cents per share, a year earlier, when it took a $10.4 billion accounting charge.

It recorded $9.8 billion in pretax benefits from the sale of China Construction Bank shares and two accounting gains. It took a pretax loss of $2.2 billion related to private equity and strategic investments.

Net interest income -- or what the bank makes on loan interest -- fell to $10.7 billion from $12.7 billion a year earlier.

The bank's net interest margin -- what it makes in loan interest versus what it pays for deposits -- shrank to 2.32 percent from 2.72 percent. Major banks like JPMorgan and Wells Fargo & Co also posted shrinking lending margins for the third quarter.

Overall, Bank of America's total revenue increased 6 percent to $28.7 billion.

For Bank of America, the drop in loan income was paired with an increase in expenses, which the bank has begun to rein in.

Noninterest expense climbed 4.7 percent to $17.6 billion.

BofA shares were down 3.3 percent at $5.83 in premarket trading.

(Reporting by Rick Rothacker and Joe Rauch in Charlotte, North Carolina; Editing by Derek Caney and John Wallace)