Gasoline prices, on an upward tear for months, have reversed course in recent weeks, giving consumers a welcome break.

Gasoline was a major reason that U.S. consumer prices were 9.1 percent higher in June than a year earlier, the biggest annual increase in four decades. But now gas prices have declined 28 days in a row, the longest decline since the collapse in energy demand in early 2020 as the Covid-19 pandemic paralyzed the economy. Energy analysts say American consumers are spending $140 million less on gasoline daily than they were a month ago.

The trend could easily reverse, especially if a hurricane knocks out a refinery on the Gulf Coast, since global oil supplies remain fairly tight. But for the moment, the nation’s inventories are slowly growing, in part because of continuing releases of oil by the government from its strategic oil reserves and reduced consumption.

The average national price per gallon of regular gasoline on Wednesday was $4.63, a drop of more than 2 cents from Tuesday, according to the AAA auto club. Prices have fallen 15 cents over the last week and 38 cents from four weeks ago, when the average price climbed to just over $5 a gallon.

The descent has been particularly sharp in Texas, Ohio, Illinois and California, all economically important states, where prices have fallen by 16 cents or more over the last week.

President Biden was quick to herald the reduction in gas prices, since their rise has been a political hazard for him.

“In the past 30 days, the average price of gas has dropped by 40 cents a gallon,” he said on Twitter. “That’s breathing room for American families.” Noting that oil prices had declined more rapidly than fuel prices, he urged oil companies to pass on their savings to consumers.

Gasoline prices are particularly important for lower-income families, who generally drive longer distances to work and own older, less efficient vehicles. But prices at the pump also frame consumers’ perceptions of inflation more widely because they observe the ups and downs on street corners every day.

Drivers are beginning to notice the difference, and like what they see.

“There’s always the fear that prices will rise but never fall,” said Melanie Wilson-Lawson, a health science professor, as she filled up her tank at a gas station outside Houston. “But I see a significant difference now. It’s huge.” That helps ease her financial insecurity, which had prompted her to cut back on dining out in recent weeks.

Ms. Wilson-Lawson said she hoped Mr. Biden’s discussions on his current trip to the Middle East would prompt oil producers to increase supplies and bring down prices. But how much more Saudi Arabia and other Middle Eastern nations can produce, even if they want to, is questionable. Production in several countries, especially Libya, has been stymied by political upheaval

Fuel affects the prices of all goods that are shipped, particularly food. Profits of farmers, construction companies and airlines depend heavily on fuel costs, particularly diesel and jet fuel, which are declining but at a slower pace than gasoline. The national average price for diesel, $5.61 a gallon, is 16 cents lower than it was a month ago.

The 3 percent decline for diesel compares with 7 percent for gasoline. Wholesale jet fuel prices, which do not include taxes like other fuels, are down roughly 11 percent over the last month, compared with 24 percent for wholesale gasoline prices. A major reason for the slower decline in domestic diesel prices is a large increase in exports to Europe to compensate for reduced supplies from Russia since its February invasion of Ukraine. Imports to the United States have shrunk to a trickle since the global diesel market tightened.

The fall in prices at the pump has followed a slump in global oil prices, which have been dropping over the last month amid growing signs that the world economy is slowing.

Fears that tightening Western sanctions on Russia would drastically reduce global oil inventories have proved overblown since Moscow succeeded in replacing European markets with sales to China, India and South America. In the meantime, expectations that the economy of China, the biggest importer of crude, would pick up have also been unfulfilled because of lockdowns in important cities in response to continuing surges of Covid-19.

Patrick De Haan, head of petroleum analysis at GasBuddy, a Boston company that tracks fuel prices, said the trend of lower gasoline prices could continue for a fifth week as long as oil prices — which have fallen below $100 a barrel — did not surge above $105.

“We’re not completely out of the woods yet,” Mr. De Haan said. “There remains the risk of a spike in prices that could send us to new record levels in August should any disruptions occur. It could be a wild ride, but for now, the plummet at the pump shall continue.”

The fluctuation of gasoline prices typically follows oil prices by roughly a week, because petroleum needs to be processed and refined before it reaches gas stations, which base their retail prices on the wholesale price.

Oil prices have been particularly volatile lately. They plunged more than 7 percent on Tuesday and were slightly higher on Wednesday. The price of Brent crude, the international benchmark, has fallen from a peak of nearly $140 a barrel shortly after the invasion of Ukraine, while the American benchmark, West Texas Intermediate, peaked above $130. Both were below $80 at the start of the year.

A report by ESAI Energy, an analytics firm, said on Wednesday that the firm expected a global surplus of four million barrels a day in the roughly 100-million-barrel-a-day market in the second quarter. “This is a significant drop in demand,” said Sarah Emerson, ESAI president.

Beyond demand, the surplus reflects releases of strategic reserves from several countries, including the United States. Those releases will eventually end, and reserves will need to be replenished in the future, adding a new source of demand as early as next year. A recovery of demand in China is likely to happen sooner or later, although Chinese reserves are currently high.

Oil production is increasing in the United States — though it remains lower than pre-pandemic levels — as well as in Guyana, Brazil and a few other countries. Oil companies are cautious about drilling too fast, in part because they fear a sudden drop in prices.