Buoyed by the recovering housing market, home builder KB Home (KBH) posted a smaller-than-expected first-quarter loss and 59% revenue growth on Thursday as average prices jumped to the best level since 2006.

Shares of the No. 5 U.S. home builder rallied about 2% on the earnings beat and optimism about the outlook for the rest of the year.

KB Home said it lost $12.5 million, or 16 cents a share, last quarter, compared with a loss of $45.8 million, or 59 cents a share, a year earlier. Analysts had been bracing for a deeper loss of 22 cents a share.

Revenue soared 59% to $405.2 million, easily topping the Street’s view of $360 million.

KB Home reported a 29% year-over-year increase in deliveries to 1,485 units, generating growth in three of its four regions.

The average selling price soared 24% from the year earlier to $271,300, representing the company’s 11th straight quarter of annual growth and highest first-quarter average price since 2006.

"Our strategies targeting growth and profitability are working,” CEO Jeffrey Mezger said in a statement.

Net orders, a closely-watched metric by analysts, leaped 40% in the first quarter to 1,671, highlighted by an 83% surge in the West Coast region.

Potential future housing revenue in backlog as of the end of the first quarter soared 53% to $460 million, while the number of homes in the backlog gained 25% to 2,763.

“These results, in combination with our current strategic growth plans, the strengthening recovery of housing markets, low mortgage interest rates and firming consumer confidence, reinforce our optimism for the remainder of the year,” Mezger said.

Shares of Los Angeles-based KB Home picked up 1.76% to $21.95 in premarket trading on Thursday morning, putting them on pace to extend their 2013 rally of 36.5%. Over the past 12 months, KB Home has surged almost 70%.

Follow Matt Egan on Twitter @MattMEgan5