The Dow closed 19 points higher on Wednesday, recovering from an early plunge of 399 points that was sparked by fears about China's slowing economy.

The S&P 500 eked out a minor gain, while the Nasdaq climbed 0.5%. That extended the Nasdaq's win streak to five days, the longest since August.

The wild swings show that while it's a new year, the same uncertainty is gripping markets. Investors continue to debate the seriousness of the economic slowdown at home and overseas.

Energy stocks helped spark Wednesday's reversal. The group traded sharply higher after oil prices went from tumbling on economic worries to spiking on signs of plunging OPEC production. Saudi Arabia's oil production tumbled by 420,000 barrels per day in December, according to a Bloomberg survey . US oil prices jumped 2.5% to $46.54 a barrel.

"The market's turn seemed to coincide with the turn in oil prices," said Mark Luschini, chief investment strategist at Janney Capital Management.

Luschini said investors have feared that oil's free fall was a "canary in the coal mine" signaling trouble about the global economy.

Halliburton ( HAL ), Hess ( HES ) and EOG Resources ( EOG ) rose sharply.

China fears

Asian and European markets careened lower early on Wednesday following the release of another weak economic report out of China . New data revealed that China's manufacturing sector contracted in December, an unsettling development for the world's second-largest economy. It is this second time this week that data has indicated China's huge manufacturing sector is shrinking.

"It is looking increasingly likely that the Chinese economy may come under greater downward pressure," said Zhengsheng Zhong, director of macroeconomic analysis at research firm CEBM Group, in a statement.

Regional manufacturing reports in the United States have also been weak lately. The ugly factory data only reinforces the economic slowdown fears at the heart of the Wall Street meltdown.

Hong Kong's Hang Seng closed 2.8% lower. The Shanghai Composite fell 1.2% and Australia's ASX dropped 1.6%.

Bargain hunting

Some investors may have decided to scoop up stocks on Wednesday that have been beaten up during the recent rout. Although S&P 500 valuations got expensive last year by historical standards, price-to-earnings ratios have come down significantly because of the market plunge.

"Valuations now look appealing," Christopher Swann, cross asset strategist at UBS Wealth Management.

Wall Street is now watching closely to see whether economic concerns translate into lower earnings -- the real driver of stock prices. Companies including FedEx ( FDX ) have already warned of trouble due to the softness from China. Last month, analysts cut their 2019 earnings forecasts on half of the companies in the S&P 500, according to FactSet.

"Earnings will undoubtedly slow in 2019 but to what extent?" Peter Boockvar, chief investment officer at Bleakley Advisory Group, wrote to clients.