Stocks moved higher on Tuesday as investors bet that April's slide in U.S. housing starts and permits signaled that the housing market may soon stabilize as the supply of new homes dwindles.

U.S. housing starts and permits fell unexpectedly to record lows in April, hitting shares in some residential construction companies such as Centex Corp , down 2.5 percent to $9.60, but leaving sentiment largely intact in sectors such as technology, retail and energy.

International Business Machines , up 1.2 percent to $105.79, and Hewlett Packard , up 3 percent to $36.79, were the top boosts to the Dow Jones industrial index, while the PHLX Semiconductor index <.SOXX> added 1.8 percent. Hewlett Packard is set to report quarterly results after the bell.

Analysts said while the housing data pointed to more headwinds in the sector, less new construction should bode well for the market in the long run as home inventories fall.

Housing starts coming down can almost be seen as progress, said Linda Duessel, market strategist at Federated Investors in Pittsburgh. We've got to keep the housing starts off because there's still too many houses, there are still way too many vacant homes that need to be sold.

Stability in the U.S. housing market is seen as key to restoring consumer confidence and stemming the flow of foreclosures that have hit financial institutions.

The Dow Jones industrial average <.DJI> added 28.51 points, or 0.34 percent, at 8,532.59. The Standard & Poor's 500 Index <.SPX> gained 5.27 points, or 0.58 percent, at 914.98. The Nasdaq Composite Index <.IXIC> rose 12.05 points, or 0.70 percent, at 1,744.41.

U.S. stocks recovered more than half of their losses on Monday, following their worst week in two months, on the back of stronger-than-expected results from Lowe's Cos Inc .

The S&P 500 has climbed from a 12-year closing low on March 9, rising 37.4 percent through the close on May 8. But the benchmark index gave up some ground last week amid profit-taking and disappointment with April retail sales.

On Tuesday, the Chicago Board Options Exchange Volatility index <.VIX>, also known as Wall Street's fear gauge, fell below 30 for the first time in eight months, extending a pullback from the bear market lows of early March.

Shares in energy companies rose as oil continued to push toward $60 per barrel. Exxon Mobil Corp rose 0.5 percent to $70.86, while the S&P energy index <.GSPE> rose 0.8 percent. Front-month crude added 1.3 percent to 59.84 per barrel.

Retailers also posted advances, with the S&P retail index up 0.6 percent. Department store Saks Inc climbed 24 percent to $5.08 after posting better-than-expected results, helped by cutting costs.

Home Depot also posted a stronger-than-expected quarterly profit, but its shares fell 4.6 percent to $24.82, making the stock the Dow's top drag. Investors said the results were disappointing compared to rival Lowe's.

Shares of American Express Co fell 2.4 percent to $25.50, a day after the credit card company said it will cut 4,000 jobs, or 6 percent of its workforce, as it grapples with rising customer defaults.

JPMorgan Chase & Co Chief Executive Jamie Dimon said the No. 2 U.S. bank expected to repay some government bailout money in a couple of weeks. The stock was off 0.8 percent to $36.99.

On Nasdaq, shares of Apple Inc were a top boost, rising 1.6 percent to $128.71, as shares of big-cap technology companies advanced ahead of HP's results.

Separately IBM's Chief Financial Officer Mark Loughridge told a Reuters Technology Summit in New York that the technology services giant expects margins to improve this year.

(Editing by Padraic Cassidy)