Stocks rose for a second day on Tuesday as investors snapped up shares in the technology sector ahead of results from Hewlett Packard , betting the tech bellwether may be the latest company to beat estimates.

In another boost to the technology sector, International Business Machines'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.

IBM, up 1.2 percent to $105.84, and Hewlett Packard , up 3 percent to $36.77, were the top boosts to the Dow Jones industrial index, while the PHLX Semiconductor index <.SOXX> added 3.5 percent. Hewlett Packard is set to report quarterly results after the bell.

There's some room here for them (Hewlett Packard) to come out and actually sound pretty positive, and I think that's what you're seeing get built in a little bit here, said Marc Pado, U.S. market strategist at Cantor Fitzgerald & Co in San Francisco.

They're a good company, he said. (They) could easily provide you with not only perhaps (an) earnings surprise from getting rid of their inventory but really strong positive comment.

The Dow Jones industrial average <.DJI> was up 26.84 points, or 0.32 percent, at 8,530.92. The Standard & Poor's 500 Index <.SPX> was up 6.28 points, or 0.69 percent, at 915.99. The Nasdaq Composite Index <.IXIC> was up 17.07 points, or 0.99 percent, at 1,749.43.

On Nasdaq, shares of Apple Inc were a top boost, rising 1.9 percent to $128.96.

Barclays Capital reiterated its overweight rating on Apple Inc and said the stock remained its top pick, given the company's new product pipeline and potential for strong free cash flow generation.

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

Analysts said while the housing data pointed to more headwinds in the sector, slower new construction meant inventories should fall, boding well for the market in the long run.

The Chicago Board Options Exchange Volatility index <.VIX>, also known as Wall Street's fear gauge, on Tuesday 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.

(Reporting by Edward Krudy, Editing by Padraic Cassidy)