Gasoline futures plunged Wednesday, pulling the price of oil with it, after an unexpected rise in U.S. inventories.

The drop was so steep that it triggered a rare five-minute halt of all energy trading on the New York Mercantile Exchange for the first time in more than two years.

June reformulated gasoline blendstock, or RBOB, settled down 25.69 cents, or 7.6%, to $3.1228 a gallon on the Nymex, the biggest one-day percentage decline since February 2009.

Light, sweet crude oil for June delivery settled down $5.67, or 5.5%, to $98.21 a barrel on the Nymex. Brent crude oil on the ICE futures exchange settled down $5.06, or 4.3%, to $112.57 a barrel. June heating oil settled down 10.29 cents, or 3.4%, to $2.8983 a gallon.

While gasoline futures began the day lower, their slide steepened after the Energy Information Administration posted a surprise increase in U.S. inventories, signaling slackening demand. Gasoline stockpiles rose 1.3 million barrels last week, the first increase since February, the EIA said in its weekly report.

"We went from anticipating a drop in gasoline inventories for last week to seeing a build instead," said Tim Evans, energy analyst at Citi Futures Perspective. "That certainly sparked some selling out of the gasoline market."

The decline in gasoline futures triggered a rare five-minute halt to energy trading just after 12 p.m. EDT, after the contract hit its daily trading limit of 25 cents. The limit was raised to 50 cents after trading resumed. The limits on light, sweet crude-oil futures and heating oil were both doubled to $20 and 50 cents, respectively.

All of the contracts revert to their old trading limits at 6 p.m. EDT. Contracts trading on the ICE don't have trading limits and trading on that exchange wasn't halted, a spokesman said.

Energy trading on the Nymex was last halted on Sept. 22, 2008, due to a surge in crude-oil prices.

Although the EIA report triggered the initial selloff in gasoline, the decline gathered significant momentum as the day went on. Market participants said traders took profits off the table after gasoline's steep climb on Tuesday, exacerbating the decline. Gasoline's premium over crude oil, called the "gas crack," hit a record $38 a barrel Tuesday before plunging more than $5 Wednesday.

"You're seeing...profit-taking from people who did catch the move on the runups in the cracks," said Raymond Carbone, a floor broker and president of Paramount Options in New York.

Crude-oil inventories rose 3.8 million barrels last week, the EIA said, exceeding analyst estimates. Supplies of distillates, including heating oil and diesel, fell 843,000 barrels.

The data suggest that demand for crude oil and gasoline is softening ahead of the critical summer driving season. Gasoline demand, as measured by delivery movements out of storage at refineries, fell 117,000 barrels last week, said the EIA, the statistical arm of the U.S. Department of Energy.

Analysts surveyed by Dow Jones Newswires had expected oil inventories to rise 1.2 million barrels. Gasoline supplies were seen falling 700,000 barrels, while stocks of distillates were expected to remain unchanged.

The EIA report also said stockpiles in Cushing, Okla., rose 1.1 million barrels to a near-record 41.6 million barrels. Rising inventories at the key oil hub and Nymex delivery point have been depressing the price of the main Nymex crude-oil contract this year. The discount of the Nymex's light, sweet crude-oil contract to Brent crude oil rose to above $14 a barrel Wednesday.