SAN FRANCISCO (MarketWatch) -- A last-minute jump Thursday pushed crude-oil futures up more than $5 to above $141 a barrel, partly recovering a loss of over $9 a barrel in the first two sessions of the week, as geopolitical tensions in oil-rich countries such as Nigeria and Iran intensified.

Crude for August delivery closed up $5.6, or 4.1%, at $141.65 a barrel on the New York Mercantile Exchange. Crude was mostly trading up less than $2 during the session, but jumped as much as $6 a few minutes before the market closed.

"This market, losing $9 in two days, has really been oversold," said Zachary Oxman, senior trader at futures brokerage Wisdom Financial. "Geopolitical pressures mixed with the oversold condition are" pushing up oil prices.

In Nigeria, the Movement for the Emancipation of the Niger Delta, or MEND, said it will end its two-week ceasefire on Saturday, the BBC reported. Meanwhile, Iran test fired missiles for a second day Thursday. Crude was also reacting to a new report by the International Energy Agency saying that global oil demand will rise in 2008.

"Fresh Iranian missile tests overnight and a declaration by MEND rebels of an end to the current cease-fire are probably motivating buyers," said John Kilduff, an analyst at MF Global, in a research note.

Crude futures had plunged by $9.25 a barrel over this week's first two sessions, pummeled by a rising dollar and economic worries, before adding just a penny Wednesday. Crude slumped $5.33 on Tuesday, the biggest daily loss since January, 1991.

Also in Nymex trading, August natural gas futures rose 20.9 cents, or 1.7%, to $12.22 per million British thermal units.

U.S. natural gas inventories gained 90 billion cubic feet in the week ending July 4 to stand at 2,208 Bcf, the Energy Information Administration reported Thursday.

Analysts at Global Insight had expected a buildup of 102 Bcf. Last week's stocks were 389 Bcf less than last year at this time and 70 Bcf below the five-year average of 2,278 Bcf, the EIA said.

Also on the energy markets Thursday, August reformulated gasoline gained 5.52 cents to $3.44 a gallon and August heating oil futures gained 19 cents to $4.04 a gallon.

Separately, Russia's state-controlled energy giant Gazprom is in negotiations to buy Libya's total export volume of gas, oil and liquefied natural gas at competitive prices, according to a statement Wednesday on Gazprom's Web site. See full story.

Geopolitical developments

The MEND said it's calling off the ceasefire following a U.K. offer to help Nigeria quell violence, the BBC reported.

British Prime Minister Gordon Brown said at the Group of Eight summit in Japan this week that the U.K. would help Nigeria "deal with lawlessness." A spokesman for the MEND vowed that U.K. interests would "suffer the consequences," according to the report.

Nigeria, a member of the Organization of Petroleum Exporting Countries since 1971, is the fifth-largest crude exporter to the U.S.

In a further escalation of tensions with the West, Iran tested more missiles after firing at least nine Wednesday, including one that could reach Israel. The U.S. said it will defend its interests and those of its allies, according BBC news reports.

But a senior U.S. military official disputed that Iran carried out a second day of missile tests, according to CNN. The unnamed source told CNN the U.S. believes Iran fired seven short- to medium-range missiles on Wednesday, and that a missile that was fired the following day was one that had failed on launch on Wednesday

Iran holds the world's second-largest proven oil reserves, beaten only by those of Saudi Arabia. It's also the fourth-largest crude producer after Saudi Arabia, Russia, and the U.S. In terms of exporters, Iran ranks fifth after the Saudis, Russia, the United Arab Emirates and Norway.

Separately, France's Total SA TOT, -1.36% (012027), the last of the major oil firms considering an investment in Iran, has opted not to go ahead, its chief executive reportedly said.

Christophe de Margerie told the Financial Times that Total won't invest in a project to develop natural-gas fields in Iran, leaving Tehran without the technical know-how to significantly raise its gas exports until late next decade. See full story.

IEA raises demand outlook

The IEA said Thursday that it expects 2009 global energy demand to rise 1% from 2008 levels. Robust growth in developing economies will more than offset demand contractions in developed countries, the Paris-based IEA said.

The IEA also said that the bunching of new projects and Saudi Arabia's pledge for 250,000 barrels a day in additional production should lead to an increase in spare capacity for crude oil next year.

But it said current high prices are not just about tight crude supplies, pointing to refinery capacity as another major contributor.

Dollar falling

The dollar fell slightly lower Thursday, partly helping push up crude prices, as a weaker greenback makes dollar-denominated commodities less expensive to buyers holding other currencies.

The dollar index DXY, +0.04% , which measures the greenback against a trade-weighted basked of currencies, fell 0.1% to 72.52 See Currencies.

Elsewhere, gold futures rose sharply Thursday, as the news from Iran boosted the safe-haven appeal of the precious metal. See Metals Stocks.