By Alison Sider

Crude prices flipped between gains and losses Wednesday as investors wavered between the surging stock market and a bearish report on growing U.S. oil inventories.

U.S. crude futures recently rose 16 cents, or 0.3%, to $53.34 a barrel on the New York Mercantile Exchange. Brent, the global benchmark, was up 10 cents, or 0.18%, at $55.54 a barrel on London's ICE Futures Exchange.

The U.S. Energy Information Administration reported a 2.8 million-barrel increase in U.S. commercial crude oil stocks in the week ended Jan. 20. That is more than the 2.1 million-barrel increase predicted by traders and analysts surveyed by The WallStreet Journal, but roughly in line with the 2.9 million barrel build reported Tuesday evening by an industry group.

"The report was bearish on its face, but that's about what [market participants] were expecting," said Mark Waggoner, president of Excel Futures. That allowed investors to focus on the stock market, which "is coming out like a wild banshee," Mr. Waggoner said.

The Dow Jones Industrial Average topped 20000 for the first time Wednesday morning on the back of enthusiasm for President Donald Trump's plans to boost infrastructure projects. The new administration's policies are also expected to benefit the U.S. oil industry, and renewed economic growth would likely boost demand for crude.

"The idea that the global economy is doing well and stock prices are going up is adding to sentiments that demand is going to increase," said Gene McGillian, research manager at Tradition Energy. Mr. MGillian said the oil market is continuing to focus on growing oil demand against a backdrop of promises of production cuts by major producers.

Oil has traded within a relatively tight range for most of January, compared with recent months, as investors have priced in production cuts planned by the Organization of the Petroleum Exporting Countries in November. The deal, along with additional cuts agreed by non-OPEC producers, has since lifted oil prices around 20%.

Still, persistently high inventories of crude and fuel in the U.S. could hamper OPEC's efforts to bring supply and demand into balance.

The EIA reported that gasoline inventories surged by 6.8 million barrels last week even as refiners choked back their production. Refinery utilization dropped to 88.3% of capacity during the week ended Jan. 20 from 90.7% the previous week. More gasoline going into storage even amid declining production and exports signals lackluster demand, analysts said.

Gasoline futures were down 2.92 cents, or 1.85%, at $1.5467 a gallon. Diesel futures were down 1.12 cents, or 0.68%, at $1.6303 a gallon.

The price rebound has also spurred an increase in drilling by U.S. shale producers. U.S. crude production ticked higher by 17,000 barrels a day, according to the new EIA data.

"This is not the kind of story OPEC wants to see," said Bob Yawger, director of the futures division at Mizuho Securities USA. "A high crude number, a higher domestic production number, refineries pulling back on utilization and still getting a load of gasoline -- they're probably not happy," Mr. Yawger said.

Sarah McFarlane

and Dan Strumpf contributed to this article.

Write to Alison Sider at alison.sider@wsj.com

(END) Dow Jones Newswires

January 25, 2017 12:28 ET (17:28 GMT)

Copyright (c) 2017 Dow Jones & Company, Inc.