Stocks rallied on Tuesday, led by the tech, industrial and materials sectors, driving the Dow and the S&P 500 to 18-month highs.

Signs of improved demand in the semiconductor industry and a broker's positive commentary on Caterpillar lifted blue chips, while tech bellwethers Apple and Cisco hit 52-week highs, indicating increased optimism among investors. Kraft , a Dow component, also hit a 52-week high.

Caterpillar Inc led the Dow industrials higher after Wells Fargo raised price targets on the company's stock on expectations for strong longer-term growth. The stock climbed 4.1 percent to $62.41.

Industrials have been among the best performers so far this year, so they're getting a lot of the momentum money, said John Massey, portfolio manager at SunAmerica Asset Management in Jersey City, New Jersey. I think it's clear we're on an upward path.

The S&P industrials sector<.GSPI> was the S&P 500's best-performing sector, with the S&P materials sector <.GSPM> also lending support. Both indexes ended slightly above 1 percent.

Semiconductor stocks were also strong performers, lifting the Nasdaq. The Philadelphia semiconductor index <.SOXX> rose 2.3 percent, while Intel Corp gained 1.9 percent to $22.67. Integrated Silicon Solution Inc surged 15 percent to $8.61 a day after it raised its second-quarter revenue and earnings outlook.

According to Stifel Nicolaus, which cited a media report, Taiwan Semiconductor Manufacturing forecast full-year revenue growth of 22 percent, compared with a previous expectation of 18 percent. The company's U.S.-listed stock rose 0.9 percent to $10.27 on the New York Stock Exchange.

The Dow Jones industrial average <.DJI> rose 102.94 points, or 0.95 percent, to 10,888.83. The Standard & Poor's 500 Index <.SPX> gained 8.36 points, or 0.72 percent, to 1,174.17. The Nasdaq Composite Index <.IXIC> shot up 19.84 points, or 0.83 percent, to 2,415.24.

The Dow chalked up its 10th day of gains out of the past 11 sessions.

The Nasdaq Composite Index <.IXIC> ended at its highest level since August 18, 2008, or about a month before Lehman Brothers collapsed during the credit crisis.

Brazilian mining giant Vale on Tuesday implemented a more flexible pricing system for iron ore, and Brazilian business daily Valor Economico reported that the company was boosting iron prices by 114 percent in 2010.

U.S.-listed shares of Vale gained 5.1 percent to $31.57 while among U.S. metal companies, U.S. Steel Corp gained 4.9 percent to $63.32.

Existing home sales fell to an annual rate of 5.02 million units in February, the National Association of Realtors said. The decline was less than forecast, but highlighted the fragility of a housing recovery.

It's incremental good news that it was better than expected, but given the huge overhang of inventory, it's clear that housing will remain a troubled sector for awhile, said Jack Ablin, chief investment officer of Harris Private Bank in Chicago.

Builder KB Home dropped 1.7 percent to $17.15 after posting a wider-than-expected quarterly loss.

Healthcare stocks lagged, giving back some of Monday's gains after U.S. President Barack Obama signed the landmark healthcare reform bill into law on Tuesday.

The Morgan Stanley Healthcare Payor index <.HMO> dropped 0.3 percent and Cigna Corp fell 0.9 percent to $36.94.

U.S.-listed shares of Baidu Inc jumped 2.6 percent to $594.88 after rival Google Inc shut down its mainland China portal and began rerouting searches to its Hong Kong operation. Google shares slid 1.5 percent to $549.

About 8.03 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's estimated daily average of 9.65 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of a little more than 2 to 1. On the Nasdaq, roughly two stocks rose for every one that fell.

(Reporting by Ryan Vlastelica; Editing by Jan Paschal)