Inflation in the United States gained pace last month as gas prices spiked in the wake of renewed fighting in the Middle East, underscoring the affordability challenges that are top of mind for many voters with midterm elections now just seven weeks away.

The consumer price index rose 3.4% last month compared with a year ago, the Labor Department said Friday, the same as in July. But on a monthly basis, inflation quickened, as costs jumped 0.4% from July to August, up from an increase of just 0.1% the previous month.

The figures show that inflation remains stubbornly elevated, more than five years after prices first soared as the economy emerged from the COVID pandemic. Friday's report increases pressure on the inflation-fighters at the Federal Reserve (Fed) to boost the benchmark interest rate at a meeting next week, which could lift mortgage and auto loan costs in the months ahead.

Fed Chair Kevin Warsh and other officials "signaled that interest rates can remain on hold only if disinflation continues and today’s August report did not deliver that," said Kathy Bostjancic, chief economist at Nationwide.

Worsening inflation isn't all due to spiking gas costs. Prices for appliances, car repairs, and wireless phone services also jumped last month. And economists worry that more expensive fuel can spill into other parts of the economy. For example, diesel prices have hit record highs above $6 a gallon, which pushes up the cost of shipping for groceries and other goods delivered by truck.