WASHINGTON—U. S. inflation hit its highest rate in more than six years, with consumer prices eating away at modest wage gains by American workers and underscoring questions about how much they are benefiting from an economy that by many other measures is booming.

The consumer-price index, which gauges what Americans pay for everything from veterinarian services to baby clothes, rose a seasonally adjusted 0.1% in June from the prior month, the Labor Department said Thursday. Excluding volatile food and energy components, so-called...