Mortgage insurer MGIC Investment Corp. posted its second straight quarterly profit as a recovery in the U.S. housing market lowered the number of defaulters, sending its shares up as much as 16 percent.

Rising house prices means fewer homeowners have loans that exceed the value of their property, cutting delinquencies.

The company’s losses from claims and defaults during the third quarter fell sharply to $180.2 million from $490.1 million.

The percentage of MGIC’s loans that were delinquent, excluding bulk loans, fell to 9.69 percent as of Sept. 30 from 12.34 percent a year earlier.

“We believe the bigger story is the second consecutive quarter of materially lower-than-expected incurred losses which enabled [MGIC] to generate two quarters of operating profit much sooner than we had expected,” Barclays analyst Mark DeVries said in a client note.

MGIC reported its first quarterly profit in about three years in the second quarter this year. The company has posted annual losses for six years.

MGIC and larger rival Radian Group Inc. have also boosted their market share after the Federal Housing Administration (FHA), their main competitor, raised premiums to replenish dwindling cash reserves.

“The opportunity presented by FHA’s problems certainly is a wonderful opportunity,” CEO Curt Culver said on a conference call.

Culver estimated the company’s market share at about 13 percent in the third quarter compared with 10 percent in the second quarter.

Private mortgage insurers accounted for 36 percent of U.S. mortgage insurance written in the second quarter—their biggest quarterly share of the market since 2008, according to a Royal Bank of Scotland report published in August.

MGIC said it did not expect profit to be hurt by a rise in interest rates due to a potential tapering of the Fed’s stimulus program.

The recent rise in interest rates has not slowed the demand for houses but has reduced the incentive to refinance mortgages, Culver said.

The company posted a profit of $12.1 million, or 4 cents per share, for the third quarter ended Sept. 30, compared with a loss of $246.9 million, or $1.22 per share, a year earlier.

New insurance written jumped 23 percent to $8.6 billion.

MGIC shares were up 14 percent at $8.29 in early afternoon trading on the New York Stock Exchange.

The stock gained more than 20 percent in the third quarter, outperforming the broader S&P 500 Index, which was up about 5 percent in the same period.

Radian shares were up more than 5 percent at $14.15, while shares of Genworth Financial Inc. rose 3 percent to $13.32 on the New York Stock Exchange.