Home builder confidence is rising, hitting its highest level in four years and raising optimism that the worst housing crisis in decades might have scraped bottom.

A widely watched gauge of builder sentiment, the NAHB/Wells Fargo Housing Market Index, increased for the fifth consecutive month in February, rising from 25 to 29, according to a report released by the National Association of Home Builders.

The data sent home-builder stocks higher: shares of Lennar Corp. (LEN), KB Home (KBH), Hovnanian Enterprises (HOV), the Ryland Group  (RYL) and Beazer Homes USA (BZH) all surged in midday trading.

There’s been a glut of housing inventory ever since the housing bubble burst in 2007. Millions of new homes were built on speculation, especially in areas of the South and Southwest, during the boom years early last decade as home values surged higher. Many of those homes have sat unsold for years.

What’s more, as home prices have collapsed and unemployment has remained stubbornly high, record numbers of Americans have been foreclose on, adding to an already bloated inventory.

In response to these factors the market for new home construction has all but dried up. Consequently, any data that suggest the market is turning around is viewed with both significant relief and a healthy dose of caution.

“This is the longest period of sustained improvement we have seen in the HMI since 2007, which is encouraging,” NAHB Chief Economist David Crowe said in a statement. “However, it is important to remember that the HMI is still very low, and several factors continue to constrain the market. Foreclosures are still competing with new home sales, and many builders are seeing appraisals come in at less than the cost of construction. Additionally, prospective home buyers are finding it difficult to qualify for a mortgage.”

In addition to rising home builder sentiment, other recent data also suggests the long-stagnant housing market could be turning around: sales of previously occupied homes rose in December for a third straight month; mortgage rates have held steady at record lows for months; and home construction picked up late last year.

The housing slump has become a prime focus of the Obama administration as the president heads into his re-election campaign. Earlier this month, the president unveiled his third attempt at helping troubled homeowners refinance their mortgages. Two earlier programs barely reached a fraction of the borrowers targeted.

And last week the government reached a $25 billion settlement with five large mortgage lenders, with most of the money earmarked for helping underwater homeowners, which means they owe more on their mortgages than their homes are worth.  

The NAHB said its index gauges builder perceptions of current single-family home sales and sales expectations for the next six months as “good,” “fair” or “poor.” The survey also asks builders to rate traffic of prospective buyers as “high to very high,” “average” or “low to very low.”

New home construction is vitally important to the U.S. economy, according to the NAHB, because of the ripple effect caused when construction is on the rise. The NAHB says each new home construction creates an average of three jobs and generates about $90,000 in taxes.

“Builder confidence has doubled since September as measured by the HMI,” said NAHB Chairman Barry Rutenberg, a home builder from Gainesville, Fla. “Given the recent improvements in new home starts and the increasing number of markets included in the NAHB/First American Improving Markets Index, this consistency suggests that the housing market is moving toward more sustainable growth.”

Follow Dunstan Prial on Twitter @DunstanPrial