President Trump said on Friday that Russia had agreed to sell millions of tons of diesel to the United States and other buyers after he spoke by phone with President Vladimir V. Putin. Hours later, the Treasury Department waived sanctions on the fuel until April.

In a post on Truth Social, Mr. Trump said Russia would “immediately supply over 300,000 tons of diesel fuel to the American and global marketplace, another 500,000 tons during the month of November, and 1,000,000 tons immediately thereafter,” Al Jazeera reported. After that, he wrote, Russia would deliver 3 million tons more “within a short period of time,” depending on “the condition of their Diesel Refineries.” The total comes to more than 4 million tons, CNBC reported.

The call came less than four weeks before the Nov. 3 midterm elections. Diesel averaged $6.28 a gallon on Friday, according to AAA, up from $5.94 a month earlier and $3.68 a year earlier, CBS News reported. The price had never topped $6 until just before Labor Day. CBS put the Sept. 22 record at $6.53. The Associated Press put it at $6.52 and gave Friday’s average as $6.23.

Treasury’s Office of Foreign Assets Control issued General License 135. It authorizes the sale, delivery and importation of Russian diesel, including into the United States, until 12:01 a.m. Eastern time on April 7, 2027, according to the license. The AP reported that it covers diesel loaded onto tankers as of Friday. It is also the first diesel waiver since the start of the Ukraine war to run past the standard 30 days. A 2022 law banning Russian energy imports into the United States remains on the books, Ship & Bunker reported.

Last month Mr. Trump signed a sanctions law named for the late Senator Lindsey Graham. It directs the administration to put tariffs of up to 100 percent on the five biggest importers of Russian oil or gas. The United States hasn’t imported either since 2022.

Volodymyr Zelensky, Ukraine’s president, called the move “a weak decision, unfortunately, a weak decision by strong partners,” in a statement released by the Ukrainian Embassy in Washington, CBC reported. “Gifts to Putin will not bring peace or any benefit to the civilized world,” he wrote online. “Russia will ‘repay’ the diesel with further terror and perfidy.”

The timing stung. Mr. Trump spoke to Mr. Putin while a senior Ukrainian delegation was in Miami for talks with the U.S. envoy Steve Witkoff and Jared Kushner, Mr. Trump’s son-in-law. “I believe our team is simply being used as a smokescreen,” Mr. Zelensky said. “And that is certainly not fair.”

On Saturday, Axios reported, citing a U.S. official, that Mr. Trump made the deal after Mr. Zelensky ignored repeated American requests to stop striking Russian refineries. Kyiv says it hit four of them this week.

Russia “confirmed its readiness to supply oil and oil products to the American and global markets,” Mr. Putin said in a Kremlin statement. “I am confident that this will have a positive impact on the entire global economy.” His aide Yuri Ushakov wouldn’t tell reporters whether Washington had offered anything in return. The White House didn’t immediately answer questions about who would pay for the diesel or when it would arrive.

Russia banned diesel exports in early July after Ukrainian drones set off fuel shortages across the country, and it extended the ban last month. That took about 800,000 barrels a day off a market already squeezed by the U.S. war with Iran, CNN reported.

The first 800,000 tons Mr. Trump listed equal about 6 million barrels, roughly a day and a half of American demand, according to Energy Information Administration figures cited by CNN. “We are talking PERHAPS a 5-6% increase in supply between now and year end,” Dan Pickering, founder of Pickering Energy Partners, said in an email. He said Mr. Trump used tons because “the tons number looks bigger to a general observer.”

Diesel futures closed down about 4 percent. Patrick De Haan, GasBuddy’s head of petroleum analysis, wrote on X that the deliveries “may be difficult to achieve” and put the near-term effect at “perhaps 10-20c/gal.”

“How does anyone take the sanctions regime seriously?” said Richard Nephew, a former State Department sanctions official.

Senator Richard Blumenthal, a Connecticut Democrat who co-sponsored the sanctions law, said the deal “makes us complicit in Putin’s war against Ukraine” and called it “an insult to Lindsey Graham’s memory.” On Thursday, a Russian strike on a bus stop in Kramatorsk, in eastern Ukraine, killed at least 33 people.

As he left the White House for a campaign rally, Mr. Trump didn’t answer shouted questions about Mr. Zelensky. “I want to thank President Putin,” he said. “So, thank you.”