Net income rose to $5.27 billion from $4.40 billion a year earlier, excluding dividend payments on preferred stock. On a per-share basis, earnings were 98 cents, beating the 93 cents forecast by Wall Street.

Interest rates on mortgages have risen sharply in recent weeks, and analysts are concerned about the potential impact on its mortgage business.

The San Francisco-based bank controls nearly a third of the U.S. mortgage market, and that has helped bolster its earnings recently. Much of its lending came from refinancing, which has been reduced by the spike in interest rates.

Wells Fargo funded $112 billion worth of mortgages, down from $131 billion in the second quarter of 2012.

The bank, however, reduced expenses to about $12.2 billion, down $142 million from a year earlier. The savings were mainly due to lower employee benefits.

Fewer bad loans cut Wells Fargo’s credit losses nearly in half to $1.2 billion. The allowance for credit losses fell to $16.6 billion as of June 30 from $17.2 billion as of March 31.

“Wells Fargo again demonstrated an ability to grow during a dynamic economic and interest-rate environment,” the bank’s chairman and CEO, John Stumpf, said in a statement.

Mortgage rates jumped late last month from near-record lows and added thousands of dollars to the cost of buying a home, after the Federal Reserve signaled that it could slow its bond purchases later this year. The average rate on a 30-year fixed mortgage rose this week to 4.51 percent, the highest in two years.

In the short run, higher rates appear to be drawing potential home buyers off the sidelines. Buyers want to get a mortgage before rates rise further from their historically low levels. In the long run, more expensive home loans might slow the housing market’s recovery, which has helped drive the U.S. economy.

At the same time, higher loan rates would allow banks to make more from mortgage lending.

Wells Fargo, the fourth-largest U.S. bank by assets, was little known outside the Western U.S. before scooping up a teetering Wachovia in the depths of the financial crisis in 2008. The bank has turned a profit every quarter since 2009, the year it wrapped up its acquisition of Wachovia.

Wells Fargo’s competitor in mortgage lending, No. 1 U.S. bank JPMorgan Chase, also reported a surge in second-quarter profits Friday and said it reduced its provision for loan losses in its consumer banking division by $1.5 billion as the number of customers failing to repay their loans remained low.

JPMorgan earned $6.1 billion in the period, up 32 percent from a year earlier.