The rebound came after a more than 3% slide a day earlier in Wall Street's main indexes, underscoring heightened market volatility ahead of the presidential election next week and growing fears of another COVID slowdown.
Stocks rallied as investors anticipated strong results from a line-up of the biggest names in the U.S. corporate universe - Apple Inc , Amazon.com Inc, Google parent Alphabet Inc and Facebook Inc - due after market close.
"The earnings season so far has resulted in significant positive earnings surprises," said Tim Ghriskey, chief investment strategist at Inverness Counsel in New York. "We think that's helping to fuel today's rally in anticipation of positive surprises from these companies."
Tech companies have seen demand surge for their products and services from people stuck at home during the pandemic. Better-than-expected earnings from Pinterest Inc, which forecast a rebound in ad spending, helped spur the rally. Shares of the image-sharing company soared more than 26.9%.
Amazon's third-quarter revenue beat Wall Street estimates as the pandemic pushed more people to shop online for groceries and other essential items on its platform. Net sales rose to $96.15 billion from $69.98 billion a year earlier.
Alphabet reported revenue rose to $46.17 billion from $40.5 billion a year earlier as the company returned to sales growth in the third quarter as businesses initially hobbled by COVID resumed advertising.
Alphabet rose 7.9% after the bell but Amazon shares fell.
The NYSE FANG+TM Index closed 3.85% higher. Communication services, materials and technology rose the most among major S&P sectors.
Sentiment also got a boost from data showing the U.S. economy grew at a record pace in the third quarter after the government poured out more than $3 trillion of pandemic aid. A separate report showed weekly unemployment claims fell last week.
"It's positive data, but it's a little bit backward looking because you have COVID-19 cases on the rise again which doesn't really send a strong signal about the fourth quarter," said Shawn Snyder, head of investment strategy at Citi Personal Wealth Management in New York.
The CBOE volatility index surged to a 15-week high this week due to lack of fiscal stimulus, while the White House coronavirus task force urged for aggressive measures to curb the pandemic.
Democratic challenger Joe Biden holds a comfortable lead over President Donald Trump in national polls, but the race in battleground states that will likely decide the election are tighter than the national surveys.
The Dow Jones Industrial Average closed up 139.16 points, or 0.52%, to 26,659.11. The S&P 500 gained 39.08 points, or 1.19%, to 3,310.11 and the Nasdaq Composite added 180.73 points, or 1.64%, to 11,185.59.
Volume on U.S. exchanges was 9.74 billion shares.
Moderna Inc, the largest gainer on the Nasdaq 100, rose 8.4%. The company said it was on track to report early data from a late-stage trial of its experimental COVID-19 vaccine next month, offering the clearest timeline yet for when the world will know whether it is effective.
Coach owner Tapestry Inc climbed 4% as it beat quarterly profit estimates and forecast growth for the year as demand for luxury handbags and apparel rebounded in China from pandemic lows.
Advancing issues outnumbered declining ones on the NYSE by a 1.88-to-1 ratio; on Nasdaq, a 1.89-to-1 ratio favored advancers.
The S&P 500 posted five new 52-week highs and 10 new lows; the Nasdaq Composite recorded 26 new highs and 78 new lows.
(Reporting by Herbert Lash, additional reporting by Medha Singh, Shivani Kumaresan and Sruthi Shankar in Bengaluru; Editing by David Gregorio, Anil D'Silva and Arun Koyyur)
By Herbert Lash