A key measure of inflation jumped sharply in June, a gain that is sure to keep concerns over rising prices front and center at the White House and Federal Reserve.

The Consumer Price Index climbed by 5.4% in the year through June, the Labor Department said, as prices for used cars and trucks accelerated rapidly and accounted for more than a third of the surge. The overall inflation change was more than the 5% increase reported in May and was the largest year-over-year gain since 2008.

Investors, lawmakers and central bank officials are closely watching inflation, which has been elevated in recent months by both a quirk in the data and by mismatches between demand and supply as the economy rebounds. Quick price gains can squeeze consumers if wages do not keep up, and the pickup could prod the central bank to pull back on support for the economy if it looks as if the inflation is going to prove sustained. The Fed’s cheap-money policies are generally good for markets, so a rapid withdrawal would be bad news for investors in stocks and other asset classes.

Policymakers expect inflation will fade as the economy gets through a volatile pandemic reopening period, but how quickly that will happen is unclear. Prices have climbed faster than officials at the Fed had predicted earlier this year, certain measures of consumer inflation expectations have risen — something that could make inflation a self-fulfilling prophecy if it becomes more extreme — and some officials at the central bank are increasingly wary. At the same time, markets have become more sanguine about the outlook for inflation.

Part of June’s annual jump owes to a data quirk called the “base effect,” which makes gains in the price index look artificially high this year. The quirk was at its most extreme in May, and started to fade slightly in the latest data, but it remains a factor behind the larger-than-usual increase.

Here is what the data for June showed:

Monthly CPI

— The index rose 0.9% from May to June, faster than the 0.6% month-over-month increase the prior month and far more than economists had expected. That was the fastest monthly jump since 2008.

Advertising

— Stripping out volatile food and fuel costs, the CPI also climbed 0.9% over the month, up from 0.7% the prior month.

Annual CPI

— The index rose 5.4% in the year through June, more than the 5% in the year through May.

— Stripping out volatile food and fuel prices, the CPI climbed 4.5% over the year, up from 3.8% in the year through May. That was the fastest pace since 1991.

Car prices, rents and restaurants

— Used car prices have been spiking partly because a semiconductor shortage has slowed manufacturing of new cars, and they rose 10.5% in June. That trend should reverse as production recovers.

— Rent and a rental equivalent for owner-occupied houses have been moving up, and the fresh data showed that continued. Because they make up nearly a third of overall inflation, that could bolster price gains going forward if it continues. Hotel prices also jumped sharply — 7.9% over the month — as demand for vacations bounced back.

— The “food away from home” category increased by 0.7% from the prior month, and 0.8% for full-service meals. Restaurants have seen demand surge even as they struggle to hire, and many have raised wages to attract workers. They may be trying to pass those costs along. Food overall was more expensive, with prices picking up by 0.8% from the prior month.

Personal consumption expenditures

— The Fed targets 2% inflation on average over time, but it defines that goal using a different inflation index. Still, the CPI is closely watched because it comes out more rapidly than the Fed’s preferred gauge and some of the CPI data feeds into the favored number, called the Personal Consumption Expenditures index. That index has also shown prices rising, and came in at 3.9% for May. June’s figure will be reported later this month.