Oil prices fell and stocks rose on Sunday after President Trump said the United States had reached a deal with Iran that would allow the “toll free” passage of ships through the Strait of Hormuz.

His social media post capped weeks of fraught negotiations between the countries that seemed at times to be making little progress. A key mediator in the peace talks, the prime minister of Pakistan, said the agreement covered Lebanon and that a signing ceremony was scheduled for Friday in Switzerland.

The specifics of the agreement remained opaque on Sunday evening, but restoring shipping through the Strait of Hormuz has been among Mr. Trump’s top priorities.

“I hereby fully authorize the toll free opening of the Strait of Hormuz, and, simultaneously herewith, authorize the immediate removal of the United States Naval blockade,” Mr. Trump posted online. “Ships of the World, start your engines. Let the oil flow!”

The removal of the U.S. blockade — which was intended to stop the flow of Iranian oil — is just one piece of restoring shipping through the narrow waterway on Iran’s southern coast. Iran would also need to relinquish its control over ship traffic. The country’s deputy foreign minister, who confirmed the deal, said Iran’s commitments under the accord would begin on Friday.

Here is the latest:

Oil prices dropped.

  • The price of Brent crude, the global benchmark for oil, fell 4 percent, to around $84 a barrel, extending last week’s losses on the hope that a deal would restore shipping through the strait.

  • West Texas Intermediate crude, the U.S. benchmark, experienced similar losses, trading Sunday evening at around $81 a barrel.

  • Investors and analysts are focused on shipping in the Strait of Hormuz, the narrow waterway between Iran and Oman and a vital trading route for oil and natural gas that normally carries as much as one-fifth of the world’s oil supply.

Stocks rose.

  • Futures on the S&P 500 pointed to a modest 0.9 percent rise when stocks resume trading in the United States on Monday.

Gasoline prices dipped.

  • Gas prices fell slightly on Sunday, to a national average of $4.07 a gallon, according to the AAA motor club. Still, gas prices for drivers are up about 37 percent since the war began.

  • Gas prices don’t move in lock step with crude, usually trailing increases or drops by a few days.

  • The average price of diesel fell slightly to $5.22 on Sunday, up about 39 percent since the start of the war.

How High Are Gas Prices Where You Live?

Here is a county-level look at where drivers are facing the highest costs.

Farnaz Fassihi contributed reporting.