The gains were broad, with all 10 primary S&P 500 sectors up on the day. Energy stocks <.SPNY> were the day's biggest gainers, up 2.2 percent, while the Philadelphia SE Oil Service index <.OSX> gained 3.4 percent.

Adding to the day's positive tone was consumer confidence data, which hit its highest since 2007 in October. The report overshadowed a separate read that showed new orders for capital goods by U.S. businesses fell the most in eight months in September.

Amgen Inc (>> Amgen, Inc.) climbed 6.1 percent to $157.19, among the top boosts for the S&P 500 and Nasdaq, a day after its 2015 outlook topped expectations. The Nasdaq Biotech index <.NBI> rose 1.3 percent.

The majority of U.S. companies reporting third-quarter results have beaten analysts' expectations so far, easing some worries about the impact of a stronger U.S. dollar and weak global demand.

"We haven't seen big global companies downgrade their outlooks because of the stronger dollar or anything else, so earnings coming in so strong has been a relief," said Channing Smith, co-portfolio manager of capital advisors growth fund at Capital Advisors in Tulsa, Oklahoma.

There have been some high-profile earnings disappointments. Twitter Inc (>> Twitter Inc) fell 9.8 percent to $43.78 after it posted a slide in a closely watched measure of engagement, even as its user base grew in the third quarter.

The Dow Jones industrial average <.DJI> rose 187.81 points, or 1.12 percent, to 17,005.75, the S&P 500 <.SPX> gained 23.42 points, or 1.19 percent, to 1,985.05 and the Nasdaq Composite <.IXIC> added 78.36 points, or 1.75 percent, to 4,564.29.

With the day's advance, the S&P 500 ended above its 50-day moving average for the first time since Sept. 29, a sign that momentum is turning more positive. The Russell 2000 <.TOY> jumped 2.7 percent and traded above its 200-day moving average for the first time since Sept. 19.

After the market closed, Facebook Inc (>> Facebook Inc) posted revenue growth of almost 60 percent. Shares were little changed in after-hours trading.

Investors were awaiting clues on the outlook for the U.S. economy from the Federal Reserve as the central bank commenced a two-day policy meeting. It is likely to reinforce expectations it will wait a long while before rising interest rates, although the Fed is all but certain to announce the end of its massive bond-buying stimulus.

Advancing issues outnumbered declining ones on the NYSE by 2,582 to 501, for a 5.15-to-1 ratio on the upside; on the Nasdaq, 2,171 issues rose and 526 fell for a 4.13-to-1 ratio.

The benchmark S&P 500 index posted 64 new 52-week highs and 2 new lows; the Nasdaq Composite recorded 133 new highs and 36 new lows.

About 6.17 billion shares traded on all U.S. platforms, according to BATS exchange data, below the month-to-date average of 7.92 billion.

(Editing by Nick Zieminski)

By Ryan Vlastelica

Stocks treated in this article : Amgen, Inc., Facebook Inc, Twitter Inc