A Bank of America branch is seen along Peachtree Street, Tuesday in Atlanta.

NEW YORK — Bank of America says its second-quarter profits soared, helped by higher earnings from investment banking and cost-cutting.

The results, reported early Wednesday, beat analysts’ expectations. The bank earned $3.6 billion in the quarter after payments to preferred shareholders. That was up 70 percent from $2.1 billion a year ago.

Per share, that worked out to 32 cents. Analysts polled by FactSet had expected 25 cents per share. The bank’s stock rose 1.7 percent in late morning trading.

Bank of America, the country’s second-biggest bank by assets, has been slimming down and cutting jobs since CEO Brian Moynihan took over at the beginning of 2010, a departure from the empire-building of his predecessors. The strategy meant to make the bank easier to manage and to escape potential extra scrutiny from regulators.

In the second quarter, the bank slashed expenses about 6 percent, to $16 billion from $17 billion a year ago. It also cut about 18,300 jobs over the year, or nearly 7 percent of its work force. The bank now has about 257,000 employees, down about 11 percent from its peak of nearly 289,000 in early 2011.

In a call with reporters, Chief Financial Officer Bruce Thompson noted that some of the job cuts were in the unit that services troubled mortgages, which is shrinking as the bank works through those loans. He also said the bank had added jobs in the unit that makes new mortgages.

The bank has also been closing branches. The number of branches fell to about 5,300, down by about 260 over the year.

Thompson said the bank would continue to trim branches, and indicated that the bank would sell branches in more rural areas — in locations “outside of our principal operating areas” and where the bank didn’t have “a critical mass of consumers.”

Bank of America benefited from lower litigation expenses, having already settled several high-profile lawsuits related to its mortgage unit earlier this year. It also was able to shrink the unit that services troubled mortgages.

The bank funded nearly $27 billion in home mortgages and home equity loans, a jump from 41 percent a year ago, though the loss in its overall mortgage business widened as the bank wound down its troubled mortgages.

Thompson said it was difficult to predict the effect that higher interest rates might have on its mortgage business. Though they’re still near historic lows, mortgage rates have been inching higher since the Federal Reserve indicated that it might pull out of some of its programs meant to support the economy.

Thompson noted that higher rates often indicated an improving economy, which could lead to more people buying homes for the first time. But higher rates will also reduce demand for refinances, which have been driving the mortgage business at Bank of America and other banks in recent quarters. About 83 percent of the mortgages that Bank of America funded over the quarter were refinances.

The net result, Thompson said, “is very difficult to predict until you see the environment you’re in.”

Investment banking and wealth management powered Bank of America’s earnings more than its consumer business did.

Total revenue was $22.9 billion after stripping out one-time charges, up 3 percent from a year ago. That was better than the $22.8 billion expected by analysts polled by FactSet.