UK inflation rose to 2.5% in July, after holding steady at 2.4% in the previous three months, as the cost of transport and computer games increased.
It was the first jump in the Consumer Prices Index (CPI) measure since November and was in line with forecasts.
Meanwhile the Retail Prices Index (RPI) measure of inflation fell to 3.2%.
The Department for Transport uses the RPI figure to set the maximum annual increase for regulated rail fares.
Despite the rise for CPI, wage growth is still outstripping inflation. On Tuesday, the Office for National Statistics said that average earnings, excluding bonuses, rose by 2.7% for the three months to June.
Wednesday's inflation figures show that increases in computer games and transport - up 5.6% in the year ending July 2018 - were partially offset by falls in the price of clothing.
For manufacturers, the cost of raw materials was 10.9% higher than in July 2017, the biggest rise in more than a year.
Much of that cost pressure has been caused by oil price increases of more than 50% over the period.
The CPI figure had hit a five-year high of 3.1% in November, when the inflationary effect of the pound's fall following the June 2016 Brexit vote reached its peak.
Earlier this month the Bank of England forecast inflation would rise to 2.6% in July before falling back.
The Bank expects inflation will settle down to just above its 2% target in two years' time as it gradually increases interest rates.
Tej Parikh, senior economist at the Institute of Directors, said the rise in inflation showed the cost of living squeeze was not yet a thing of the past.
"For households this isn't good news, as the already weak growth in their pay packets is being further eroded by high prices. This is likely to weigh down consumer spending, posing fresh problems for embattled high street businesses," he said.
"As the temporary factors pushing prices up fade away, inflation is expected to slowly fall back close to the target rate, but that will offer little respite for workers without a significant pickup to their salaries in tandem."
Samuel Tombs at Pantheon Macroeconomics added: "Unless inflation in the services sector strengthens dramatically, CPI inflation will fall below the 2% target in the first half of next year."