Traders waited to see if a tropical storm could affect some of Mexico's crude production. There were also concerns about supplies from the Middle East after two pipelines carrying Iraqi crude to world markets were shut down, while rebels continued to battle government forces in Syria's largest city.
In New York, benchmark U.S. crude increased $1.57 to $93.77 per barrel in afternoon trading. It rose as high as $94.42 earlier. Brent crude, which is used to price international varieties of oil, increased $2.41, or 2.2 percent, to $111.99 per barrel, in London
Oil prices also benefited from expectations that Europe, the U.S. and China will take fresh steps to promote economic growth, thereby boosting demand for oil. A rally in global stock markets also persuaded investors to buy riskier assets like commodities.
Meanwhile, analysts expect drivers on the West Coast of the U.S. to soon pay more for gas after a fire shut Chevron Corp.'s big Richmond refinery.
Chevron closed the refinery near San Francisco after a fire broke out Monday. There is no immediate word on when it will reopen. The refinery accounts for about 10 percent of all refining capacity on the West Coast and primarily produces gasoline.
Motorists should expect to soon see pump prices average more than $4 per gallon ($1.05 a liter) along the West Coast, said Tom Kloza, chief oil analyst at Oil Price Information Service. The average price for a gallon of regular in California was $3.86 on Tuesday.
Authorities say Tropical Storm Ernesto could intensify into a hurricane and has the potential of moving into the Bay of Campeche, which houses two of Mexico's oil production areas. Mexico was the seventh-largest oil producer in the world in 2010 and the third-largest exporter to the U.S. last year, according to the Energy Information Administration.
Other tropical storms also are beginning to form that could affect oil tankers delivering supplies to the U.S.
"People have to realize it doesn't necessarily have to take a major storm to slow down imports into the Gulf Coast," Price Futures Group oil analyst Phil Flynn said.
In other trading on the New York Mercantile Exchange, wholesale gasoline rose 6 cents to $2.99 per gallon; heating oil rose 5 cents to $3 per gallon; and natural gas rose 3 cents to $2.94 per 1,000 cubic feet.
AP Energy Writer Jonathan Fahey contributed to this report from New York.