(New throughout, updates prices and market activity)
By Barani Krishnan
NEW YORK, Jan 4 (Reuters) - Oil prices slid on Monday, erasing an early rally in volatile trade, as concern about Middle East tensions gave way to worries about a slowing global economic growth and sliding stock markets.
Data showing an inventory build last week at the Cushing, Oklahoma delivery hub for U.S. crude futures also weighed on sentiment, traders said.
Brent LCOc1 , the global oil benchmark, was down 5 cents, at $37.23 a barrel by 1:14 p.m. EST (1819 GMT). In early trade, Brent hit a near three-week high of $38.99.
U.S. crude's West Texas Intermediate (WTI) futures CLc1 fell 20 cents, to $36.84. It had traded as high as $38.39.
WTI was also weakened by data from market intelligence firm Genscape that showed a build of more than 480,000 barrels in Cushing supply, traders who saw the data said.
Global equity markets fell after a 7 percent slide in Chinese shares, sparked by weak economic data, rekindled worries about global growth. MKTS/GLOB U.S. stock indexes lost about 2 percent. .N
Earlier in the session, oil had rallied after a breakdown in diplomatic ties between Saudi Arabia and Iran that some analysts speculated could result in supply restrictions on crude shipments out of the Middle East.
"The Saudi-Iran standoff is certainly one to worry over given its ramifications for oil supply," said Phil Flynn, analyst at the Price Futures Group brokerage in Chicago.
"But the equity markets selloff is more pressing and difficult to ignore because of the impact of China on the global economy and overall demand for oil."
Surveys in China showed factory activity in the world's second-largest economy shrank sharply in December, sparking a 7 percent slide in Chinese shares that triggered a trading halt. urn:newsml:reuters.com:*:nL3N14K1SS
The clash between Saudi Arabia and Iran comes as Tehran, which holds some of the largest proven reserves, hopes to ramp up oil exports following the expected removal of sanctions against it under a deal over Iran's contested nuclear programme. urn:newsml:reuters.com:*:nL8N14O25I
Iran plans to raise output by half a million to 1 million barrels per day (bpd) after sanctions are lifted. urn:newsml:reuters.com:*:nL8N14N06J
Energy Aspects analyst Richard Mallinson said the market is grappling with the question of "where next in the Saudi Arabia/Iran stand-off? I think President (Hassan) Rouhani on the Iranian side would like to calm things down and push for no further escalation."