NEW YORK (Reuters) - Oil prices edged lower on Thursday, giving back early gains as traders grew less concerned about tensions between the United States and Iran.

Slideshow ( 2 images )

U.S. President Donald Trump said on Thursday in a tweet that Iran had been “put on notice” after the country tested a ballistic missile.

In morning trade, crude prices briefly climbed to their highest levels since early January due in part to the tough talk over the missile test since the possibility of a confrontation in the Gulf region could put world oil supplies at risk.

“Once it did not seem like a conflict was in the offing, prices leveled off,” said Rob Haworth, senior investment strategist at U.S. Bank Wealth Management in Seattle.

Brent futures fell 24 cents, or 0.4 percent, to settle at $56.56 a barrel, while U.S. West Texas Intermediate crude fell 34 cents, or 0.6 percent, to settle at $53.54.

U.S. gasoline futures fell 2.9 percent.

“The big action on Thursday was in the products market,” said Andrew Lipow, president of Lipow Oil Associates in Houston, noting that U.S. gasoline inventories were within 1 percent of the record set a year ago.

Indications producers from the Organization of the Petroleum Exporting Countries (OPEC) and other exporters were following through on their agreements to cut output to reduce a global supply glut also boosted oil prices earlier.

Russian oil output contracted in January by 100,000 bpd, Energy Ministry data showed. Earlier this week, a Reuters survey found most key oil producers were sticking to the deal, with compliance above 80 percent.[OPEC/O]

OPEC and other exporters agreed last year to reduce supplies by a combined 1.8 million barrels per day (bpd) to prop up prices that remain at about half their mid-2014 levels.

OPEC and non-OPEC producer Russia, however, are shielding Asian customers from those supply cuts and instead have reduced deliveries to Europe and the Americas.

Higher crude prices in recent months have prompted U.S. energy producers to drill for more oil. [RIG/U]

U.S. crude inventories rose last week by 6.5 million barrels to 494.76 million barrels, the Energy Information Administration said on Wednesday, far exceeding forecasts for an increase of 3.3 million barrels. [EIA/S]

Crude inventories in the United States, the world’s biggest oil consumer, have been near record highs for much of the past year and domestic production is rising as U.S. companies drill for shale oil.