Inflation rose to a higher-than-expected 0.6% last month as the increasing cost of motor fuels and second-hand cars drove up transport prices.
Consumer Price Index (CPI) inflation in July was up from 0.5% in June, the Office for National Statistics (ONS) said.
Economists were expecting the figure to be unchanged.
But while there was no sign of the plunge in the value of the pound having an impact on CPI, the ONS said the Producer Prices Index (PPI) showed the slump in sterling following the Brexit vote had pushed up the cost of imports for British manufacturers.
Input prices rose 4.3% in the year to July, compared with a drop of 0.5% in the year to June, as it was partly impacted by the fall in the value of the pound, which drove up the cost of imported metals and chemicals.
Mike Prestwood, head of prices at ONS, said: “The Consumer Prices Index has continued in July its recent slow upward trend since late 2015, with transport costs the biggest single factor this month.
“There is no obvious impact on today’s consumer prices figures following the EU referendum result, though the Producer Prices Index (PPI) suggests the fall in the exchange rate is beginning to push up import price faced by manufacturers.
“These are the first sets of consumer and producer prices data collected since the referendum polling day.”
The ONS said CPI was impacted by transport costs rising by 1.6% between June and July this year, compared with a 1.2% increase over the same period a year ago, while the prices of second-hand cars fell less than they did a year ago.
It added that alcoholic drinks also stepped up 0.5% month on month in July, compared with a fall a year ago, as wine prices dropped by less than they did in 2015.