Brent crude futures were up $1.08 at $110.91 a barrel by 1455 GMT, off an earlier session-high of $111.46. US crude rose 71 cents to $87.46.
An explosion hit a bus in the heart of Tel Aviv on Wednesday, wounding at least 10 people in what officials said was a terrorist attack.
This dented mounting hopes that a ceasefire may be brokered in coming days.
"It's the main reason why oil prices are up today against the trend of falling commodities prices," said Carsten Fritsch, analyst at Commerzbank in Frankfurt.
"Supply risks are back in focus as is the pricing in of the risk premium," Fritsch added.
Israeli air strikes shook the Gaza Strip and Palestinian rockets struck across the border as US Secretary of State Hillary Clinton held talks in Jerusalem in the early hours of Wednesday.
Although little oil is produced in Israel or neighbouring Egypt, concern that major hydrocarbon producing Arab nations could become involved in the conflict have aroused fears that supplies from the Gulf can be disrupted.
Prices are likely to move fairly rapidly as the course of the Gaza conflict unfolds, said Jeremy Friesen, commodity strategist at Societe Generale in Hong Kong.
"We're going to see some crazy volatility in the market with rising geopolitics and rising economic uncertainty. The Middle East tensions could continue to give prices some life in the near term but we suspect that bearish economic factors will be dominant."
Oil price gains were capped as worries for the demand outlook returned to the fore after euro zone finance ministers ended a meeting in Brussels on Wednesday without agreement on the next tranche of loans to Greece.
Concerns on the US economy also weighed on prices, as Federal Reserve Chairman Ben Bernanke warned that failure to resolve a budget crisis could lead to recession in the world's biggest oil consumer.
However, US jobs data gave limited cause for optimism as the number of Americans filing new claims for jobless benefits fell last week, though jobless numbers remained elevated due to superstorm Sandy.
Investors will watch US inventory data from the Energy Information Administration at 1530 GMT for more clues on the outlook for supply.
Crude oil and gasoline inventories were forecast to have increased last week while distillate stockpiles were seen down on higher heating oil demand.
US crude oil inventories tumbled last week due to a drop in imports, data from the American Petroleum Institute released on Tuesday showed.
Total US crude stocks fell by more than 1.9 million barrels in the week to November 16, after analysts polled by Reuters had forecast a build of 900,000 barrels.
Copyright @ Thomson Reuters 2012