(Reuters) - Bank of America Corp (>> Bank of America Corp), the No. 2 U.S. bank by assets, reported its biggest quarterly profit in nearly four years as expenses fell to their lowest since the financial crisis.

BofA, which has paid at least $70 billion in legal expenses since 2008, said its legal costs fell for the second straight quarter, suggesting the bank was finally putting to rest its problems stemming from the crisis.

Litigation expenses fell to $175 million from $4 billion a year earlier, allowing the bank to reap the benefits of the cost cuts introduced by Chief Executive Brian Moynihan after he assumed the top job at the bank in 2010.

BofA's non-interest expenses fell by a quarter to $13.82 billion in the three months to June 30.

At the same time, net interest income rose 4.7 percent to $10.49 billion - the first rise in five quarters.

"We also benefited from the improvement in the U.S. economy, where we are particularly well positioned," Moynihan said.

BofA's core net interest income is expected to rise over the rest of 2015 even without interest rate hikes, Chief Financial Officer Bruce Thompson said on a conference call.

The bank's legacy assets and servicing unit, which houses many of the bad loans BofA inherited with its purchase of Countrywide Financial, also posted a small profit compared with a loss of $2.7 billion in the year-earlier quarter.

The gain was driven by a recent court ruling that said New York's six-year statute of limitations on lawsuits related to mortgage-backed securities should start when investors initially buy mortgage-backed securities, not when issuers refuse to buy back or replace them.

Net income attributable to shareholders more than doubled to $4.99 billion, or 45 cents per share, in the quarter from $2.04 billion, or 19 cents per share, a year earlier.

The results were helped by a one-time accounting adjustment on mortgage bonds linked to rising interest rates.

On an adjusted basis, BofA earned 37 cents per share, according to Thomson Reuters I/B/E/S, beating the average analyst estimate of 36 cents.

BofA's shares were up 4 percent at $17.83 in afternoon trading on the New York Stock Exchange on Wednesday.

MORTGAGE REVENUE JUMPS

The fourth-biggest U.S. mortgage lender said its mortgage banking revenue almost doubled to $1 billion.

More than half of the quarter's new mortgage loans were for home purchases, rather than the refinancings that previously drove revenue in the business.

Wells Fargo & Co (>> Wells Fargo & Co), the biggest issuer of mortgages in the United States, reported a drop of 1 percent in revenue from its home-lending business on Tuesday.

BofA said its income from investment and brokerage services rose 3 percent to $3.39 billion, while revenue from the bank's Merrill Lynch Global Wealth Management business was little changed at $3.79 billion.

Moynihan, on a conference call with analysts, said Merrill Lynch still had more work to do on expense management.

Revenue from bond trading fell 9.3 percent to $2.15 billion.

JPMorgan Chase & Co (>> JPMorgan Chase & Co.), the biggest U.S. bank, said on Tuesday its revenue from fixed-income trading fell 21 percent.

Banks were expected to report muted results from bond trading as the Greek debt crisis and uncertainty about the timing of a U.S. rate hike unsettled investors.

However, BofA is less exposed to interest rate-sensitive government securities than some of its competitors, focusing more on trading credit instruments such as corporate bonds.

Thompson said BofA's headcount was 7 percent lower in the second quarter compared with the same period last year and that he expected a further decline. BofA had 220,000 full-time employees as of March 31.

Goldman Sachs Group Inc (>> Goldman Sachs Group Inc) and Citigroup Inc (>> Citigroup Inc) will report results on Thursday and Morgan Stanley (>> Morgan Stanley) on Monday.

(Additional reporting by Neha Dimri in Bengaluru; Editing by Ted Kerr)

By Richa Naidu and Anil D'Silva