Big earnings surprises gave a positive turn to investor sentiment on Wednesday, propelling U.S. stocks to their best day in a month and lifting the Dow industrials to their highest in almost three years.

Investors had been set up for a series of disappointments but got an unexpected treat from blue chips Intel Corp and United Technologies Corp , sparking a broad-based rally that puts equities on the path for more gains in coming weeks.

The S&P 500 broke decidedly above its 20-day moving average, setting a near-term target at 1,340, according to its Bollinger bands chart, a technical indicator that tracks momentum and volatility.

Until yesterday, earnings were lackluster, not too exciting, even disappointing, said Nick Kalivas, senior equity index analyst at MF Global in Chicago. He said the last round of reports shifted the psychology quite significantly.

Shares of Intel rose 7.8 percent to $21.41 while United Tech gained 4.3 percent to $85.90.

Among companies adding to the positive tone were VMware Inc , Freeport-McMoRan Copper & Gold and EMC Corp , which also raised its profit view.

The Dow Jones industrial average <.DJI> gained 186.79 points, or 1.52 percent, to 12,453.54. The Standard & Poor's 500 <.SPX> rose 17.74 points, or 1.35 percent, to 1,330.36. The Nasdaq Composite <.IXIC> added 57.54 points, or 2.10 percent, to 2,802.51.

The Nasdaq posted its largest daily percentage gain since October while the Dow hit its highest close since early June 2008. The broad S&P 500 had its best performance in a month.

The PHLX Semiconductor index <.SOX> jumped 4.3 percent, the largest percentage gain since early July.

About 7.6 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below last year's estimated daily average of 8.47 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of nearly 5 to 1, while on the Nasdaq, about 10 stocks rose for every three that fell.

Sales of previously owned U.S. homes rose more than expected in March, a trade group said on Wednesday, suggesting the housing market's downward trend may be close to hitting a bottom.

The PHLX housing sector <.HGX> index rose 1.2 percent with home builder D.R. Horton Inc up 3 percent at $12.17.

On the downside, International Business Machines Corp slipped 0.4 percent to $164.75 after reporting a drop in signings of new business at its global services division during the first quarter. However, the Dow component's profit and revenue came in above analysts' projections and it raised its full-year profit view.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)