WASHINGTON (AP) — U.S. inflation accelerated 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 to boost the benchmark interest rate at a meeting next week, which could lift mortgage and auto loan costs in the months ahead.

Federal Reserve 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.

WATCH: Fed Chair Warsh not ruling out interest rate hike amid inflation concerns