In this Oct. 8, 2014, file photo, American flags fly in front of the New York Stock Exchange. AP

U.S. stocks surged Wednesday, recovering much of their losses from a Christmas Eve plunge and placing the market on track for its best day in nine months.

Gains in technology companies, retailers, health care and internet stocks drove the broad rally, which gave the benchmark S&P 500 index some breathing room after it slid Monday to just shy of what Wall Street calls a bear market — a 20 percent fall from an index’s peak.

Energy stocks also rebounded as U.S. crude oil prices surged toward their biggest one-day gain in more than two years.

Click to resize

Trading volume was lighter than usual following the Christmas holiday. Markets in Europe, Hong Kong and Australia were closed.

“Today simply can only be really chalked up to a reflex rally after having been oversold,” said Sam Stovall, chief investment strategist for CFRA. “The real question is do we have follow-through for the rest of this week.”

The S&P 500 index rose 63 points, or 2.7 percent, to 2,414 of 2:51 p.m. Eastern Time. The Dow Jones Industrial Average climbed 580 points, or 2.7 percent, to 22,372. The tech-heavy Nasdaq gained 228 points, or 3.7 percent, to 6,421. The Russell 2000 index of smaller-company stocks picked up 40 points, or 3.2 percent, 1,307.

Wednesday’s gains provide the S&P 500 some breathing room after finishing the shortened trading session Monday just shy of a bear market. It would mark the end to the longest bull market for stocks in modern history after nearly 10 years.

Stocks fell sharply Monday after President Donald Trump lashed out at the central bank. Administration officials had spent the weekend trying to assure financial markets that Fed chairman Jerome Powell’s job was safe. On Tuesday, Trump reiterated his view that the Federal Reserve is raising interest rates too fast, but called the independent agency’s rate hikes a “form of safety” for an economy doing well.

“The market is trying to find an equilibrium between earnings, revenue growth and the economy, but when you have an onslaught of headlines that just manifest uncertainty from Washington, it just feeds negative sentiment,” Krosby said.

The market’s sharp downturn since October intensified this month, erasing all of its 2018 gains and nudging the S&P 500 closer to its worst year since 2008. Despite Wednesday’s rally, stocks are on track for their worst December since 1931, during the depths of the Great Depression.

“This is a market that’s heavily oversold, and typically you expect a strong bounce following that,” said Quincy Krosby, chief market strategist at Prudential Financial. “Oil prices have just moved quite markedly. And retail is having a very strong holiday season.”

The lackluster finish to 2018 comes as most economists expect growth to slow in 2019, though not by enough to slide into a full-blown recession. Many economic barometers still look encouraging. Unemployment is at 3.7 percent, the lowest since 1969. Inflation is tame. Pay growth has picked up. Consumers boosted their spending this holiday season.

Even so, traders have been jittery this autumn over signs that the global economy is slowing, the escalating U.S. trade dispute with China and another interest rate increase by the Fed. Many investors are growing worried that corporate profits -- which drive stock market gains -- are poised to weaken.

Some of what Wall Street sees coming out of the White House has added to the market’s uncertainty, specifically the president’s attacks on the Fed and remarks about the ongoing trade conflict with China.

The president could help restore some stability to the market if he “gives his thumbs a vacation,” Stovall said.

“Tweet things that are more constructive in terms of working out an agreement with Democrats and with China. And then just remain silent as it relates to the Fed,” Stovall said.

Technology stocks accounted for much of Monday’s early bounce. Adobe rose 6.1 percent to $217.71. Payment processors Visa and Mastercard also headed higher. Visa added 4.3 percent to $126.99, while Mastercard gained 4.2 percent to $182.05.

Big retailers were among the gainers. Amazon climbed 6.9 percent to $1,436.47. Kohl’s gained 8.3 percent to $64.75. Nordstrom picked up 4.2 percent to $46.06.

Homebuilders mostly rebounded after an early slide following a report indicating that annual U.S. home price growth slowed in October. PulteGroup climbed 2.2 percent to $25.22.

Benchmark U.S. crude climbed 8.6 percent to $46.20 a barrel in New York. Brent crude, used to price international oils, gained 7.8 percent to $54.72 a barrel in London.

The pickup in oil prices helped boost energy stocks. Marathon Petroleum rose 4.8 percent to $56.93.

Bond prices fell. The yield on the 10-year Treasury note rose to 2.79 percent from 2.75 percent late Monday.

The dollar strengthened to 111.13 yen from 110.41 yen on Monday. The euro weakened to $1.1357 from $1.1404.

Gold edged up 0.1 percent to $1,273 an ounce and silver gained 2 percent to $15.12 an ounce. Copper gained 1.5 percent to $2.70 a pound.

The partial U.S. government shutdown that started Saturday is unlikely to hurt the economy much, although it may deprive the financial markets of data about international trade and gross domestic product. The Bureau of Economic Analysis said Wednesday that it’s required to suspend all operations until Congress approves funding, which means that the government might not release its fourth-quarter report on gross domestic product as scheduled for January 30.

In other trading Wednesday, South Korea’s Kospi gave up 1.3 percent, while Japan’s Nikkei 225 index, which plunged 5 percent on Tuesday, picked up 0.9 percent. Shares fell in Taiwan, Singapore and Indonesia, but rose in Thailand.

AP Economics Writer Josh Boak contributed to this story from Washington.