The global oil-price benchmark closed above $70 a barrel for the first time in two years Tuesday on investors’ optimism that improving demand and a dwindling supply glut may mean the market can absorb any additional production from OPEC and its allies.

Brent crude rose 93 cents, or 1.3%, to $70.25 a barrel, the highest close since May 2019. West Texas Intermediate futures gained $1.40, or 2.1%, to $67.72 a barrel. The U.S. gauge settled at its highest level since October 2018.

Members of the Organization of the Petroleum Exporting Countries and their allies, a group known as OPEC+, on Tuesday agreed to continue relaxing curbs on oil production, signaling their confidence in improving oil demand and a drop in the global supply glut. Prices began rallying after a technical committee within the cartel on Monday confirmed forecasts for a rebound of six million barrels a day in world oil demand this year, according to people familiar with OPEC and its allies.

Vaccination programs are enabling governments across North America and Europe to reduce coronavirus restrictions and resume more normal economic activity. That will help pare global oil stocks—which at one point last year threatened to overwhelm the world’s ability to store them—to below their five-year average by the end of July for the 2015-19 period, the OPEC committee projected. In the U.S., oil and oil-product inventories have fallen more than expected in recent weeks, thanks in part to a pickup in demand for transportation fuels.

Brent crude closed at its highest level since May 2019.

Brent crude closed at its highest level since May 2019.

Photo: angus mordant/Reuters

“The bull recipe for the oil market is still intact: reviving demand, muted U.S. shale oil response together with controlled and restrictive supply from OPEC+, resulting in further declines in inventories and yet higher oil prices,” said Bjarne Schieldrop, chief commodities analyst at Swedish bank SEB.

The OPEC cartel and its allies agreed Tuesday to press ahead with earlier plans to increase output by 450,000 barrels a day starting in July. Meanwhile, Saudi Arabia will continue to unwind its unilateral cuts of one million barrels a day that it put in place earlier this year.

“Demand growth is outpacing supply gains even with the agreed month-by-month OPEC+ production increases taken into account,” said Ann-Louise Hittle, vice president of Macro Oils at consulting firm Wood Mackenzie. “Sticking to increases planned at the April meeting is what the market needs,” she added.

Even so, the cartel and its allies stopped short of signaling their plans for after July. That is partly because negotiations are under way between Iran and Western powers to revive a nuclear deal and possibly lift economic sanctions on Tehran.

Both oil prices and future OPEC+ policy could be affected if as much as 1.5 million barrels a day of Iranian oil, currently restricted by U.S. sanctions, return to the market, according to Robert McNally, a former adviser in the George W. Bush administration and president of consulting firm Rapidan Energy Group.

“Oil prices should remain firm until it’s clear whether, when and by how much OPEC+ will continue increasing quotas after July,” said Mr. McNally. That “depends in part on the timing and amount of Iran’s potential return to unsanctioned exports,” he added.

The prospect of Iranian oil flowing back into the global market dimmed Monday, when the International Atomic Energy Agency criticized Iran’s lack of cooperation in explaining the agency’s discovery of undeclared nuclear material at several locations in Iran since the fall of 2019.

That has boosted oil prices this week, according to Giovanni Staunovo, commodity analyst at UBS Wealth Management.

OPEC ministers will also watch Asia’s largest economies in considering their next moves.

While fresh data showed that China’s manufacturing sector continued to expand in May, India’s spiraling coronavirus infection rates could stymie the recent recovery in oil demand, said Mr. McNally.

Write to David Hodari at David.Hodari@dowjones.com