The U.S. Energy Information Administration (EIA) said domestic crude inventories rose 3.1 million barrels last week, more than the 2.2 million-barrel build forecast by analysts in a Reuters survey.

Just on Tuesday, preliminary inventory data by the American Petroleum Institute had suggested a drawdown of 1.2 million barrels. [API/S].

Brent , the global crude benchmark, settled down 59 cents, or 1.1 percent, at $51.33 a barrel.

The West Texas Intermediate (WTI) benchmark for U.S. crude slid 72 cents, or 1.5 percent, to settle at $47.81.

Brent and WTI had gained around 8 percent, or about $4 a barrel, over the past three days, breaking above a month-long trading range on technical buying and supportive data.

The rally was partly fueled by an EIA report on Tuesday that projected global oil demand for 2016 will grow by the fastest rate in six years, suggesting a crude surplus was easing quicker than expected.

On Wednesday, crude prices rose as much as $1 early, then gave all that back to trade a few cents on either side of break-even.

The crude build reported by the EIA "will take some of the wind out of the market's sails" and force traders to rethink the market's direction, said Gene McGillian, analyst at Tradition Energy in Stamford, Connecticut.

The EIA also reported a near 2 million-barrel gasoline build that was four times bigger than expected. McGillian likened that data to pouring "cold water on the market".

Tariq Zahir, oil trader at Tyche Capital Advisors in Laurel Hollow, New York, predicted that high inventories would keep weighing on crude prices.

"Overall, we have a real battle going on, with crude technically having broken out of the range we have been in for more than a month. $50 for WTI is in sight," Zahir said. "But fundamentally we are seeing builds and that should continue in the weeks to come."

He cited impending arrival of Iranian oil as nuclear-related sanctions against Tehran come off, and an Atlantic hurricane season that so far has left U.S. oil installations undamaged.

Some traders believed crude was still poised for gains.

"The key technical indicators are positive," said Robin Bieber, director of London brokerage PVM Oil Associates. "It is not advised to be short."

(Additional reporting by Koustav Samanta in New York, Christopher Johnson in London and Aaron Sheldrick in Tokyo; Editing by David Evans, Diane Craft, David Gregorio and Richard Chang)

By Barani Krishnan