NEW YORK — Oil prices edged higher on Wednesday as stocks and the dollar bounced back from a huge early slide after Donald Trump’s victory in the presidential election.

Crude oil prices tumbled as much as 4.0 percent to near $43 a barrel, a near two-month low, late Tuesday night as it became clear U.S. voters picked Trump as their next president.

That selloff was part of a broad-based market reaction where investors late Tuesday night fled risky assets such as stocks and the dollar, which since have recovered in value.

Brent futures rose 32 cents, or 0.7 percent, to settle at $46.36 a barrel, while U.S. crude gained 29 cents, or 0.6 percent, to settle at $45.27 per barrel.

“If you just look at today’s close versus yesterday’s close, not that much happened. But, there was a near $2-a-barrel roller coaster ride in the middle,” said James Williams, president of energy consultant WTRG Economics in Arkansas.

“Oil markets started to recover from their overnight lows once it became clear that Trump had won the election,” Williams noted.

With the Trump victory, some analysts said there were supportive factors for oil prices such as a potential shift in U.S. policy toward Iran.

Trump has criticized the West’s nuclear deal with Iran, an accord that has allowed Tehran to increase crude oil exports sharply this year. Iran said Trump should stay committed to the deal.

The Obama administration said it will remain committed to the Iran deal through its final months.

“It remains to be seen whether U.S. President Trump will revoke the nuclear agreement with Iran that he has criticized so strongly,” Commerzbank said in a note.

“If so, oil prices would presumably rise.”

Other analysts, however, said the Organization of the Petroleum Exporting Countries attempts to prop up oil prices just got much harder with the Trump win.

The oil-producing cartel may have to battle weaker demand for crude if global economic growth slows in the wake of Trump’s victory, and on the prospect of increased U.S. oil output given Trump’s pledge to open all federal land and waters for fossil fuel exploration.

In an attempt to boost prices, OPEC agreed in September to cut output, although investor doubts have grown that it will be able to implement the deal at its next meeting on Nov. 30.

Oil prices remain at less than half of their level of mid-2014, pressured by excess supplies.

Oil prices briefly tumbled on Wednesday after the U.S. Energy Information Administration released weekly data showing another build in U.S. crude inventories, but eventually the market looked past it.

EIA said U.S. crude stockpiles rose 2.5 million barrels last week, a million more than analysts had forecast.

“The report is fairly neutral, and the market is accordingly having a muted response,” said Matt Smith, director of commodity research at energy data provider ClipperData.