Wells Fargo & Co, the biggest US mortgage lender, has posted a higher-than-expected 20% rise in quarterly profit as it set aside less money to cover bad loans and earned more from its mortgage business.

The results reflect the strengthening US housing market, which is cutting the bank's expenses for items such as managing foreclosed homes.

Income from making home loans rose 9% from a year earlier.

Mortgage lending gains may slow in coming quarters, analysts said. Mortgage interest rates have risen in recent months as longer-term bonds have sold off, which will likely cut into future mortgage lending profit.

Wells Fargo Chief Executive John Stumpf said on a conference call that the bank is diversified and has some businesses that perform better when rates rise.

The fourth-biggest US bank by assets said net income applicable to common stockholders rose to $5.27 billion, or 98 cents per share, in the second quarter from $4.40 billion, or 82 cents per share, a year earlier.

Analysts had expected 93 cents per share, according to Thomson Reuters I/B/E/S.

It was the bank's 14th consecutive quarter of higher earnings per share.

The bank's provision for bad loans fell 64% to $652 million.

The rise in US interest rates since early May contributed to a slowdown in mortgage refinancing, which accounted for 54% of Wells Fargo's mortgage applications in the second quarter, down from nearly two-thirds in the first quarter.

Overall US demand for refinancing fell 45% in the latest quarter, according to the Mortgage Bankers Association.

Wells Fargo made $112 billion of home loans in the quarter, down from $131 billion a year earlier but up from $109 billion in the first quarter.

Income from mortgage lending totalled $2.41 billion.

Wells Fargo had a 22% share of the US mortgage market in the first quarter, down from 27.7% at the end of the 2012 fourth quarter, according to Inside Mortgage Finance, an industry publication.

Thirty-year mortgage rates rose to 4.58% at the end of the second quarter, up 0.82% point from the first quarter.

Wells Fargo shares were up 2% at $42.74 in morning trading. The stock has risen about 20% this year, roughly in line with the increase in the KBW index of bank stocks.

The bank's net interest margin, an indicator of how profitable its loans are, fell to 3.46% in the second quarter from 3.91% a year earlier and 3.48% in the first quarter.

Rising interest rates should ease pressure banks have faced on their margins, but that trend will take time to bear fruit.

Wells Fargo's total second-quarter revenue rose marginally, to $21.37 billion from $21.29 billion a year earlier. Non-interest expenses fell to $12.25 billion from $12.40 billion.

JPMorgan Chase & Co, the biggest US bank by assets, reported a higher-than-expected 31% rise in quarterly profit earlier today. Its trading revenue rebounded and it set aside less to cover bad loans.

JPMorgan is the second-biggest provider of mortgages in the United States, with an 11 percent market share.