KB Home reported quarterly results Friday that beat analyst expectations thanks to increased housing sales and higher home prices.

The company’s net loss for the fiscal second quarter ended May 31 was $24.1 million, or 31 cents a share, compared with a loss of $68.5 million, or 89 cents, for the same quarter last year. Based on a survey by Bloomberg, analysts had expected a loss of 35 cents a share.

In a statement, the Los Angeles-based new home builder said the results reflected an increase in the number of homes delivered and a higher average selling price.

The company sold 1,290 new homes in the quarter, an increase of 2 percent from the same quarter last year. The central and southeast regions of the country had gains of 13 and 5 percent respectively, while the West Coast and Southwest regions reported declines.

The average selling price was $233,000, a 9 percent increase from the same quarter last year. Prices in the West Coast region increased 33 percent and in the Southwest region 14 percent during the quarter.

At midday Friday, shares of KB Home were trading at $9.71, a gain of $1.01 or 12 percent on the New York Stock Exchange.