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.

The trend of positive earnings continued after the market's close, with Apple Inc up 2.7 percent at $351.80 after a blowout quarter that surged past expectations. Revenue for the tech giant rose 83 percent year-over-year.

F5 Networks Inc , considered a momentum favorite for investors, climbed 11 percent to $110.39 after its second-quarter profit topped expectations and the company forecast third-quarter earnings largely above estimates.

Following the results, Nasdaq futures rose 0.7 percent.

On the downside, American Express Co slid 1.3 percent to $46.40. While the Dow component's profit topped expectations, expenses at the credit card company rose.

During the regular session, companies adding to the positive tone included VMware Inc , Freeport-McMoRan Copper & Gold and EMC Corp -- with EMC also raising 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 and Ryan Vlastelica; Editing by Jan Paschal)