SAN FRANCISCO (MarketWatch) -- Crude-oil futures climbed to unprecedented levels Thursday, as weakness in the U.S. dollar, influenced by the U.S. Federal Reserve's decision to stand pat on interest rates, sent prices to a peak above $140 a barrel.

Comments from OPEC's president warning of higher oil prices because of the dollar's decline as well as reports that Libya threatened to cut crude output, helped bolster energy prices.

Crude oil for August delivery reached a high of $140.39 a barrel in electronic trading on Globex as of 3 p.m. Eastern.

The contract closed at a record $139.64 on the New York Mercantile Exchange, up $5.09, or 3.8%, for the session after trading as high as $140.

The Fed is driving weakness in the dollar and that's driving oil prices higher, said Kevin Kerr, president of Kerr Trading International.

"$150 is now very likely," said Kerr, who's also editor of MarketWatch's Global Resources Trader.

“ 'Crude oil is unlikely to face a major correction without a major bottom in the dollar or large cut in global demand.' ” — Thomas Hartmann, Altavest Worldwide Trading

"Crude oil is unlikely to face a major correction without a major bottom in the dollar or large cut in global demand," said Thomas Hartmann, an analyst at Altavest Worldwide Trading. "Inflation appears on track to get 'out of control' before the situation improves."

On the currency markets Thursday, the U.S. dollar fell against most of its major rivals. The dollar index DXY, +0.05% , which tracks the greenback against other major currencies, was at 72.484, compared with 72.90 in late North American trading Wednesday, following the Fed's announcement. See Currencies.

Dollar-denominated commodities such as crude oil and gold typically benefit from dollar weakness, since that makes them more attractive for holders of other currencies.

Fed, OPEC talk

On Wednesday, in a statement released after the Fed held its target for short-term interest rates steady at 2%, the central bank sharpened its focus on inflation, saying that the risks posed to the economy by upward pressure on prices have increased. See full story.

But "the Fed's decision to not fight inflation is having a direct impact on crude-oil prices, along with many other commodities," said Hartmann in emailed comments.

Hartmann wonders if the Fed is unaware that the falling dollar is a major contributor to price increases around the globe. "If so, then the outlook for crude-oil prices is higher," he said.

U.S. stocks fell sharply Thursday with the blue-chip index marking its worst close since September 2006 after Goldman Sachs Group downgraded U.S. brokers and advised selling shares of General Motors Corp. See Market Snapshot.

"I can't remember the last time Dow futures in freefall the way they've been today," said Dale Doelling, chief market technician at Trends In Commodities. It's "an absolute boycott by buyers in stocks and the dollar."

But "the exact opposite happened in the commodity markets. You name it, oil corn, gold bonds -- everything up, up and away," he said in emailed comments.

Also providing support for oil Thursday, Algerian Energy Minister Chakib Khelil, who serves as president of OPEC, said oil prices could jump as high as $150 to $170 dollars a barrel this summer, according to reports.

However, he thinks crude will fall short of $200 a barrel. At a meeting in Paris, Khelil said a further fall of 1% to 2% of the dollar vs. the euro could add another $8 a barrel to oil prices. He cited the weakness of the greenback as a major cause of spiking oil prices.

Also Thursday, Libya threatened to cut oil output because of a U.S. threat to its assets and an assumption that the oil market is oversupplied, according to a report from Bloomberg. A U.S. law allows terror victims to seize assets of foreign governments as compensation, the report said.

An output cut from Libya, or any other member of OPEC, could offset Saudi Arabia's planned increases in production, Bloomberg reported. The Saudis has said it would boost its production to 9.7 million barrels per day beginning in July. See full story.

Supply and demand mix

On Wednesday, crude ended lower, but pared its earlier steep losses after the Fed announcement.

Crude prices posted a fall of $2.45, or 1.8%, on Wednesday after a government report showed that supplies of crude rose unexpectedly for the first time in six weeks and demand for petroleum products had fallen more than 2% in the past month. See full story.

On Thursday, prices for petroleum products followed crude prices higher. July reformulated gasoline rose 11.7 cents to close at $3.5113 a gallon and July heating oil gained 13.4 cents to end at $3.8834 a gallon.

The average U.S. price for a gallon of regular gasoline was unchanged at $4.067 Thursday from a day earlier, but it's up 36.7% from a year ago, according to AAA's Daily Fuel Gauge Report.

In a report released Thursday, AAA said it estimates a decline in the number of Americans traveling during the July 4 holiday travel period -- that'll be the first time in a decade. It expects 40.45 million Americans will travel that weekend, down 1.3% from a year ago. Read more.

Natural-gas prices turn up

Prices for natural gas recovered from their earlier lows to close around 3% higher after the Energy Department reported that natural-gas inventories rose by 90 billion cubic feet for the week ended June 20.

Global Insight expected the data to show an increase of 89 billion, but analysts at Strategic Energy & Economic Research were looking for a larger 97 billion gain.

July natural gas futures rose 35.2 cents to close at $13.105 per million British thermal units, recovering from a low of $12.55. The contract expired at the close of the day's trading, likely adding to market volatility. August natural gas closed at $13.248, up 38.2 cents.

"Unless there is substantial improvement in the inventory situation or oil prices fall dramatically, natural-gas prices will stay near their current levels over the next few weeks," said Patrick Armstrong, an assistant economist at Moody's Economy.com, in a weekly report.

Total stocks now stand at 2.033 trillion cubic feet, down 382 billion cubic feet from the year-ago level and 56 billion cubic feet below the five-year average, the government data said.

Meanwhile, energy equities finished lower. The Philadelphia Oil Service Index OSX, -2.83% closed down 0.4%. See Energy Stocks.

In other commodities trading, boosted by the weak dollar, gold futures rallied almost $33 an ounce on Thursday. See Metals Stocks.

Coffee futures rose Thursday in New York trade to their highest level in more than three months on concerns that winter frost in Brazil, the world's largest producer, will cripple coffee production. See Food Futures.