Updated from 2:53 p.m. EDT

Oil futures shot to a record high Wednesday as traders used a decline in U.S. gasoline inventories as their latest excuse to buy.

Crude for September delivery closed up $1.83 to $64.90 a barrel on Nymex, after briefly touching $65 a barrel. Gasoline futures surged 7 cents to a record high of $1.89 a gallon. Gasoline spot prices have increased 63% this year.

According to the Energy Department, crude inventories rose by 2.8 million barrels last week, surprising analysts who expected them to fall slightly. Distillate inventories rose by 2.6 million barrels, also more than expected, while gasoline fell by 2.1 million barrels, roughly in line with expectations.

"Oil is up strong today, led by the draw in unleaded gasoline," says Phil Flynn, senior market analyst at Alaron Trading. "People were hoping that the fall in gasoline stocks would come to an end, but that didn't happen." Refinery outages worsened the gasoline shortfall.

Analysts also noted that most of the build in crude inventories occurred on the West Coast; in other areas of the country, inventories fell.

"This is massive speculation, not based on fundamentals," saysGeorge Henel, an independent oil trader. "The big builds today were just ignored. This market could hit a wall and move down quickly."

Gasoline inventories continue to be below the seasonal average despite refineries running at 95% capacity. Refineries produced 8.8 million barrels of gasoline a day last week and 4.3 million barrels of distillates a day. Distillate demand is still 4.4% higher than a year ago.

The Amex Oil Index rose 1.1% Wednesday. Exxon Mobil ( XOM - Get Report) rose 1.2%, Chevron climbed 1.5%, ConocoPhillips ( COP - Get Report) increased 1.4%, Royal Dutch Shell added 0.8%, and BP ( BP - Get Report) rose 1.25%.

The Philadelphia Oil Service Sector Index rose 2%.

Crude futures eased Tuesday after the Energy Department said global demand growth has slowed from a year ago. The slowdown was largely attributable to weaker growth from China, the world's second-biggest oil consumer after the U.S, which is expected to consume 500,000 barrels a day more than it did a year ago. In 2004, China's consumption grew by 1 million barrels a day.

U.S. embassy operations in Saudi Arabia have reportedly restarted after a two-day shutdown that followed security threats. Despite resumed operations, many are still concerned over political instability in the No. 1 oil exporter.

In corporate news, the merger between Chevron ( CVX - Get Report) and Unocal is nearly completed after shareholders voted to accept the merger in preliminary elections. The election will be finalized on Aug. 17.

As for BP, the Associated Press reported that the British oil giant said its Russian joint venture, TNK-BP, received a significant reduction in back-tax claims from the Russian government. The debt for 2001 was reportedly cut by two thirds to $246 million, though an additional $141 million in tax claims for 2002 and 2003 are still outstanding.

The reduction in tax claims is a positive sign, analysts say. Many have expressed concern that the Kremlin's recent tax-slapping actions on foreign oil companies operating in Russia would stem investments there.

In earnings news, W&T Offshore ( WTI - Get Report), which drills in the Gulf of Mexico, said net income for the second quarter in 2005 was $45.8 million, or 69 cents a share, on revenue of $149.8 million, compared with net income of $34.7 million, or 53 cents a share, on revenue of $126.1 million a year ago. Results beat analysts' average earnings estimate by 6 cents a share, according to the Thomson Financial poll.

Drilling success and higher realized prices of gas and oil led the gains. Net cash from operating activities increased 69% to $126.1 million during the second quarter, though production was essentially flat at 13.3 billion cubic feet.

Shares of W&T Offshore rose $1.37, or 5%, to $29.16.