NEW YORK - Oil prices rose Wednesday after the government said U.S. crude oil supplies fell more than predicted last week.

Light, sweet crude for August delivery gained $1.52 to US$142.49 a barrel on the New York Mercantile Exchange.

However, that same report offered a mixed picture of energy use by the world's thirstiest oil consumer. Gasoline supplies unexpectedly grew by a considerable amount, and demand continued to slide -- suggesting that record fuel prices are leading to a real shift in Americans' driving habits.

Prices at the pump hit a new high ahead of the July 4 holiday weekend, jumping half a penny overnight to a new national record of $4.092 a gallon on average -- nearly $1.08 a litre -- according to AAA, the Oil Price Information Service and Wright Express.

In Canada, gas prices averaged nearly C$1.39 a litre according to GasBuddy.com, a website that tracks gasoline prices across North America.

Still, energy traders chose to focus on the crude oil numbers, pushing prices sharply higher within an hour of the report's release.

"The main feature was the drop in crude stocks,'' said Jim Ritterbusch, president of energy consultancy Ritterbusch and Associates in Galena, Ill.

The Energy Department's Energy Information Administration said crude oil supplies fell by two million barrels last week. Analysts surveyed by the energy research firm Platts predicted a more modest decline, of 1.2 million barrels.

Gasoline stockpiles rose by 2.1 million barrels, although analysts predicted they would decline by half a million barrels. Demand for gasoline over the four weeks ended June 27 was 1.7 per cent lower than a year earlier.

Ongoing rhetoric about possible attacks on Iran also unnerved the market. Iran's oil minister warned Wednesday that an attack on his country would provoke a fierce response. Minister Gholam Hossein Nozari said, however, that Tehran would not cut oil deliveries and would continue supplying the market even if struck by Israel or the United States.

Over the weekend, the commander of Iran's Revolutionary Guards warned that Tehran would respond to an attack by barraging Israel with missiles and could seize control of a key oil passageway in the Persian Gulf, the Strait of Hormuz.

But a senior U.S. military commander said Wednesday that Washington would not allow that to happen.

Vice Adm. Kevin Cosgriff, commander of the 5th Fleet spoke to reporters after talks with naval commanders of Gulf countries in the United Arab Emirates capital of Abu Dhabi.

The 5th Fleet is based in Bahrain, across the Gulf from Iran. Cosgriff said that if Iran choked off the Strait of Hormuz, it would be "saying to the world that 40 per cent of oil is now held hostage by a single country.''

"We will not allow Iran to close it,'' he told reporters.

In other Nymex trading, heating oil futures rose 8.4 cents to $4.0270 a gallon, while gasoline futures rose 0.06 cent to $3.514 a gallon. Natural gas futures dipped 6.5 cents to $13.44 per 1,000 cubic feet.