The Homer Ferrington gas drilling rig, operated by Noble Energy and drilling in an offshore block on concession from the Cypriot government, is seen during President Demetris Christofias' visit in the east Mediterranean, Nicosia November 21, 2011.
The Homer Ferrington gas drilling rig, operated by Noble Energy and drilling in an offshore block on concession from the Cypriot government, is seen during President Demetris Christofias' visit in the east Mediterranean, Nicosia November 21, 2011. Reuters / Handout .

Oil prices dipped on Thursday but still hovered near three-month highs after parts of Shanghai imposed new COVID-19 lockdown measures although China's stronger-than-expected exports in May offered a boost to the demand outlook.

Brent crude futures for August fell 44 cents to $123.17 a barrel as of 12:11 p.m. EDT (1611 GMT), while U.S. West Texas Intermediate crude for July lost 62 cents, or 0.5%, to $121.26 a barrel.

Oil prices have been rallying steadily over the last two months, led by big increases in prices of refined products due to tight refining supply and surging demand.

China's May exports jumped 16.9% from a year earlier as easing COVID curbs allowed some factories to restart, the fastest growth since January this year and more than double analysts' expectations.

But while the Chinese trade figures were upbeat, oil prices eventually reversed their earlier modest gains.

"Of far greater importance is news that a district of Shanghai has been locked down today, reviving fears of another leg of China weakness due to its COVID-zero policies. That is capping any gains in Asia today," said Jeffrey Halley, OANDA's senior market analyst for Asia Pacific.

"That said, it is indicative of how tight supplies are that oil has not retreated on that news today."

Parts of Shanghai began imposing new lockdown restrictions on Thursday, with residents of Minhang district ordered to stay home for two days to control transmission risks.

"The export performance is impressive in the context of the country's multi-city lockdowns in the month," Stephen Innes, managing partner at SPI Asset Management, said in a note.

Meanwhile, peak summer gasoline demand in the United States continued to provide a floor to prices.

U.S. gasoline stocks unexpectedly dropped last week, government data showed on Wednesday, indicating resilience in demand for the motor fuel during the peak driving period despite sky-high pump prices.

"It's hard to see significant downside in the coming months, with the gasoline market likely to only tighten further as we move deeper into driving season," said ING's head of commodities research Warren Patterson.