Stocks closed broadly higher on Wall Street Wednesday, adding to the market's gains this week ahead of the Christmas holiday.

The S&P 500 rose 1% after coming back from an early slide. The other indexes also recovered after sliding into the red in the early going. The Dow Jones Industrial Average rose 1.1% and the Nasdaq closed 1.2% higher. The Russell 2000, a measure of small-company stocks, rose 0.9%.

Every major U.S. index is still on track for weekly gains after a choppy several days where stocks bounced between sharp losses and solid gains.

“We’ve had strength yesterday and today, so the markets are generally positive this week following a fair amount of pressure last week,” said Terry Sandven, chief equity strategist at U.S. Bank Wealth Management.

The S&P 500 rose 47.33 points to 4,696.56. The index is now within 0.4% of the all-time high it set Dec. 10.

The Dow gained 261.19 points to 35,753.89, while the Nasdaq rose 180.81 points to 15,521.89. The Russell 2000 gained 18.96 points to 2,221.90.

The latest surge in coronavirus cases because of the omicron variant has been hanging over markets, along with concerns about rising inflation and its impact on economic growth.

The Commerce Department on Wednesday said the U.S. economy grew at a 2.3% rate in the third quarter, slightly better than previously thought. But prospects for a solid rebound going forward are being clouded by the rapid spread of the latest variant of the coronavirus.

“The market is a little uncertain about that (omicron), but seems somewhat convinced that it isn’t going to turn into another lockdown,” said Scott Wren, senior global market strategist at Wells Fargo Investment Institute.

Even so, the uncertainty over the latest variant's impact on the economy is likely to cause more stock market swings.

“Clearly, the pace of economic recovery is being held hostage by omicron, and that’s resulting in increased volatility,” Sandven said. “By our metric, volatility is likely to be more the norm versus the exception, and for good reason.”

Governments in Asia and Europe have tightened travel controls or pushed back plans to relax curbs already in place. In the U.S., President Joe Biden announced Tuesday the government will provide rapid-test kits and increase vaccination efforts but gave no indication of plans for restrictions that might disrupt the economy.

Investors have also been busy shifting money between sectors as the close of the year approaches and they prepare for higher interest rates in 2022. The Federal Reserve has said it will hasten the process of cutting its bond purchases that have helped maintain low interest rates and that opens the door to rate increases from the central bank in 2022.

Nearly 80% of companies in the S&P 500 rose Wednesday. Retailers and other companies that rely on consumer spending accounted for a big share of the gains. They rose following the encouraging consumer confidence report.

Tesla jumped 7.5% for the biggest gain in the S&P 500 after CEO Elon Musk reportedly said he sold enough stock to reach his goal of selling 10% of his stake in the electric vehicle maker.

Technology and health care stocks also helped lift the market. Microsoft rose 1.8% and Abbott Laboratories rose 2.8%.

Traders bid up shares in cruise lines, hotel operators and other travel-related stocks. Carnival rose 3.5%, Marriott gained 2.7% and Expedia Group picked up 2.9%.

Energy futures rose, with the price of U.S. crude oil rising 2.3%.

Bond yields edged mostly lower. The yield on the 10-year Treasury fell to 1.46% from 1.48% late Tuesday.

Indexes closed mostly higher in Europe and Asia.

U.S. markets will be closed Friday in observance of Christmas.

Copyright 2021 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.