U.S. crude oil surged on Wednesday, posting its biggest one-day percentage gain in more than two years.

The advance came a day ahead of the Brent February contract's expiration and on the day that options for the U.S. contract expire, brokers and traders said. Other analysts pointed to the dollar's weakness against a basket of currencies.

Brent reversed earlier losses to trade about 3 percent higher.February Brent crude was up $2.24, at $48.27 a barrel. The contract slipped earlier on U.S. crude stockpiles and weak World Bank growth forecasts.

Energy Information Administration data showed U.S. crude stocks rose by 5.4 million barrels in the last week, far more than analysts' expectations for an increase of 417,000 barrels, pointing to continued oversupply in the market.

The World Bank lowered its 2015 and 2016 world economic growth forecasts on Tuesday, reinforcing worries about sluggish expansion in energy demand.

Oil prices that have fallen by about 60 percent since June are wreaking havoc on economies that depend on commodities exports. Russian Finance Minister Anton Siluanov called for a 10 percent spending cut on everything but defense on Wednesday.

Oil had tumbled nearly 5 percent on Tuesday before closing down 1.8 percent, with global benchmark Brent briefly trading at par with U.S. prices for the first time in three months as some traders moved to take advantage of ample U.S. storage space.

The U.S. shale oil boom and steady OPEC production have created a global supply glut. U.S.-based PIRA Energy Group said American stocks could be approaching 80 percent of capacity by the spring, in a report published before the EIA's data release.