* U.S. crude stocks rise unexpectedly to highest since 2017 - EIA
* Attacks on tankers, Saudi oil infrastructure help prices
* U.S. pulls staff from Iraq amid concerns over Iran
* U.S. oil output, inventories: tmsnrt.rs/2WhrAut (Updates prices and market activity to settlement, adds analyst comments)
By Laila Kearney
NEW YORK, May 15 (Reuters) - Oil futures inched up on Wednesday as the prospect of mounting tensions in the Middle East hitting global supplies overshadowed an unexpected build in U.S. crude inventories.
Brent crude settled at $71.77 a barrel, gaining 53 cents or 0.7%. West Texas Intermediate (WTI) crude futures settled at $62.02 a barrel, climbing 24 cents or 0.4%.
U.S. crude inventories rose unexpectedly last week to their highest since September 2017, while gasoline stockpiles decreased more than forecast, the Energy Information Administration (EIA) said.
Crude stocks swelled by 5.4 million barrels, surprising analysts who had expected a decrease of 800,000 barrels.
Still, the build was smaller than the nearly 9 million-barrel build estimate on Tuesday by the American Petroleum Institute (API), a trade group, which helped lift crude price sentiment. The drawdown in gasoline stocks also helped oil futures, analysts said, with U.S. gasoline futures gaining about 2%.
Rising uncertainty in the Middle East, however, boosted crude prices the most.
“Although crude oil inventories built more than the market expected due to higher imports, prices remained supported due to the geopolitical dynamics of the Middle East,” said Andrew Lipow, president of Lipow Oil Associates in Houston.
Oil prices have drawn support since Saudi Arabia said on Tuesday that armed drones struck two oil pumping stations, two days after the sabotage of oil tankers near the United Arab Emirates.
“Given that nearly one-third of global oil production and nearly all of global spare capacity are in the Middle East, the oil market is very sensitive to any attacks on oil infrastructure in this region,” Swiss bank UBS said.
The attacks took place against a backdrop of U.S.-Iranian tension. Washington has been trying to cut Iran’s oil exports to zero with sanctions while beefing up the U.S. military presence in the Gulf.
Washington ordered the departure of non-emergency American employees from its diplomatic missions in Iraq on Wednesday in show of concern about threats from Iran-backed forces.
“There could be a pretty serious conflict with Iran should they do something to U.S. forces in the region, and that would spike the price of oil,” said Josh Graves, senior commodities strategist at RJO Futures in Chicago.
However, a clash could prove bearish if it prompts Saudi Arabia to ramp up supply “given the kingdom’s sizable amount of unused output capacity,” Jim Ritterbusch of Ritterbusch and Associates said in a note. A supply-disruption could also lead the United States to boost its oil output, he said.
The International Energy Agency said the world would require very little extra oil from the Organization of the Petroleum Exporting Countries this year as booming U.S. output will offset falling exports from Iran and Venezuela.
The energy watchdog also revised its forecast for 2019 growth in global oil demand 90,000 barrels per day lower to 1.3 million bpd.
Additional reporting by Ahmad Ghaddar in London, Scott DiSavino in New York, Aaron Sheldrick in TOKYO and Colin Packham in SYDNEY; Editing by Marguerita Choy and David Gregorio