U.S. stocks staged a late-day rally on Wednesday as an 8 percent jump in oil prices lifted beaten-down energy shares and financials rebounded.

The Nasdaq stayed weaker but ended well off the day's lows.

Oil prices snapped a two-day rout as after investors took advantage of a weaker U.S. dollar. Comments by Russia's foreign minister reignited hopes of a deal among oil producers to trim output.

The energy index jumped 4 percent.

"Oil helped turn around the overall market. The market shot up like an arrow and then what you had was a lot of short covers," said Robert Pavlik, chief market strategist at Boston Private Wealth in New York.

The dollar's decline eased worries about the impact of dollar strength on U.S. multinationals' earnings. Shares of 3M Co., up 3.1 percent at $152.52, led gains in the Dow.

The Dow Jones industrial average ended up 183.12 points, or 1.13 percent, to 16,336.66, the S&P 500 gained 9.5 points, or 0.5 percent, to 1,912.53 and the Nasdaq Composite dropped 12.71 points, or 0.28 percent, to 4,504.24.

Apple, up 2 percent at $96.35, returned to its position as the world's most valuable company, pushing Alphabet back into second place as the Internet giant's shares dropped 4 percent to $749.38.

The S&P materials was up 3.3 percent, the day's second-best performing sector. The S&P financial index ended down just 0.1 percent after hitting its lowest in more than two years.

Stocks' late-day rally reversed sharp losses in morning trading. U.S. data showed the economy's service sector expanded at a slower-than-expected rate, raising concerns that weakness in manufacturing was spreading to other areas of the economy.

In other economic news, ADP data showed private employers added more jobs than expected in January. The data comes ahead of the government's more comprehensive employment report on Friday.

Tepid U.S. growth, falling oil prices, and fears regarding a China-led global slowdown have combined to drive stocks down sharply since the start of the year.

About 10.2 billion shares changed hands on U.S. exchanges, above the 9.2 billion daily average for the past 20 trading days, according to Thomson Reuters data.

Advancing issues outnumbered decliners on the NYSE 1,920 to 1,102, for a 1.74-to-1 ratio on the upside; on the Nasdaq, 1,393 issues fell and 1,391 advanced for a 1.00-to-1 ratio favoring decliners.

The S&P 500 posted 22 new 52-week highs and 56 new lows; the Nasdaq recorded 16 new highs and 236 new lows.

(Additional reporting by Tanya Agrawal; and Abhiram Nandakumar; Editing by Savio D'Souza and Richard Chang)