US oil settles up 4.0%, at $45.92 a barrel

Bearish crude inventory data
Opportunity to take cost out of oil: GE CEO
Commodities 'extremely inexpensive': Dennis Gartman

Oil prices rallied 4 percent on Thursday as traders' focus on strong U.S. demand for gasoline overshadowed news of increased U.S. inventories of crude.

A weaker dollar also made dollar-denominated crude more affordable to holders of the euro, while higher equity prices on Wall Street enhanced bullish sentiment in oil markets.

U.S. crude futures closed up $1.77, or 4.0 percent, at $45.92 a barrel. Brent crude, the global benchmark for oil, rose by $1.20, or about 2.5 percent, to $49.70 a barrel.

U.S. Energy Information Administration data on Thursday showed demand over the latest four-week period was up almost 4 percent from a year ago, while gasoline inventories rose just about half of expected levels last week.

Read MoreHere's why Saudi Arabia is caught in 'perfect storm'

The attention paid to gasoline inventories overrode interest in EIA data showing stockpiles of U.S. crude oil rose nearly 2.6 million barrels last week, more than double the build of 933,000 barrels forecast by analysts in a Reuters poll.

The rise was mitigated, however, by a crude drawdown at the Cushing, Oklahoma delivery point for U.S. crude.

A Shell Oil facility in Carson, California
Mike Blake | Reuters

"Demand ... remains strong year-over-year as consumers take advantage of low gasoline and distillate prices," said Chris Jarvis, analyst at Caprock Risk Management in Frederick, Maryland.

Oil was down earlier in Asian trading after the region's biggest economy, China, reported a near 6 percent drop in its producer price index in August. That was the 42nd consecutive month of declines in the PPI, and the biggest drop since the depths of the global financial crisis in late 2009.

Read MoreSaudi Arabia August oil output dips slightly: Industry source

Car sales in China fell 3.0 percent in August from a year earlier to 1.7 million vehicles, the fifth straight monthly drop as the country's slowest economic expansion in 25 years wiped out growth in the world's top auto market.

Oil prices have fallen by over half since June 2014 due to a global supply glut reinforced by the slowdown in China and other Asian economies, which have been the main growth engine for commodities in recent years.

The slump has been exacerbated by OPEC's interest in protecting market share over prices. Sources said Thursday top oil exporter Saudi Arabia was disinclined to hold a summit of oil producing countries if the discussions would fail to produce concrete action towards defending oil prices.