By Benjamin Pimentel

Technology stocks closed Tuesday with moderate gains, as strength in the chip industry helped drive the rest of the sector.

By the closing bell, the Nasdaq Composite Index (RIXF) was up 0.4% at 2,146. The Morgan Stanley High Tech 35 Index (MSH) gained 0.7% to close at 542.32. The Dow ended the day up 51 points, or 0.5%, at 9,829.87.

The Philadelphia Semiconductor Index (SOX) gained 0.9% to close at 329.33. Driving the chip category was Applied Materials (AMAT), which picked up 4.8% to close at $13.27, and Advanced Micro Devices (AMD), which closed up 4.7% at $6.08.

Intel Corp. (INTC) closed down by a penny to $19.53. The chip giant kicked off its Intel Developer Forum in San Francisco on Tuesday.

Google (GOOG) passed the $500 mark during the session for the first time since August 2008. The shares closed trading Tuesday at $499.06, up 0.4% from the previous close. Several analysts have upped their price targets on the stock over the last two weeks, on optimism that the slowdown that hit the global ad market is now starting to abate.

Online retail giant Amazon.com (AMZN) gained 3.5% to close at $93.75. EBay (EBAY) closed up 1.2% at $24.45.

On the hardware side, Hewlett-Packard (HPQ) closed the day with gains of 1.4% to $47.01 after the company was upgraded to an outperform rating by Credit Suisse. Analyst Bill Shope predicted that the company's printer business has hit bottom, and it will also benefit from a resurgent PC market.

"Our bearish thesis has been primarily focused on our concerns over cyclical pressures in the Imaging and Printing segment," he wrote in a report. "We now believe those concerns are widely understood by investors and we believe we are now past the cyclical bottom in this division."

Shope also downgraded Dell Inc. (DELL) to a neutral rating, on fear that the company will struggle to integrate the large $3.9 billion acquisition of Perot Systems that was announced Monday.

Other gains came from Apple Inc. (AAPL), EMC Corp. (EMC) and Microsoft (MSFT), which closed the day up 1.9% at $25.77.