U.S. consumer prices accelerated in June as gasoline and food costs remained elevated, resulting in the largest annual increase in inflation in 40-1/2 years and cementing the case for the Federal Reserve to hike interest rates by 75 basis points later this month.

The consumer price index increased 1.3% last month after advancing 1.0% in May, the Labor Department said on Wednesday.

Economists polled by Reuters had forecast the CPI would rise 1.1%. Consumer prices are surging, driven by snarled global supply chains and massive fiscal stimulus from governments early in the COVID-19 pandemic.

The ongoing war in Ukraine, which has caused a spike in global food and fuel prices, has worsened the situation.

U.S. gasoline prices hit record highs in June, averaging above $5 per gallon, according to data from motorist advocacy group AAA. They have since declined from last month's peak and were averaging $4.631 per gallon on Wednesday, which could ease some of the pressure on consumers.

The inflation data followed stronger-than-expected job growth in June. The economy created 372,000 jobs last month, the government reported last Friday, with a broader measure of unemployment falling to a record low.

Labor market tightness is also underscored by the fact that there were nearly two jobs for every unemployed person at the end of May. The Fed wants to cool demand in the economy to bring inflation down to its 2% target.

Financial markets overwhelmingly expect the U.S. central bank to raise its policy rate by another three-quarters of a percentage point at its July 26-27 meeting. It has hiked its overnight interest rate by 150 basis points since March.

In the 12 months through June, the CPI jumped 9.1%. That was the biggest gain since November 1981 and followed an 8.6% rise in May. There had been hope that a shift in spending from goods to services would help cool inflation. But the very tight labor market is boosting wages, contributing to higher prices for services.

Underlying inflation pressures remained strong last month. Excluding the volatile food and energy components, the CPI gained 0.7% in June after climbing 0.6% in May. The so-called core CPI increased 5.9% in the 12 months through June. That followed a 6.0% rise in the 12 months through May

High inflation and rising borrowing costs are stoking fears of a recession by early next year. (Reporting by Lucia Mutikani; Editing by Paul Simao and Chizu Nomiyama)