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.
Meanwhile, food and non-alcoholic drinks fell 0.2% between June and July, which is lower than a 0.7% drop over the period last year.
However, downward pressure on CPI came from the price of housing, water, electricity, gas and other fuels, which was unchanged over the period after rising by 0.3% last year, while recreation and culture costs slipped 0.1% this year compared with a 0.2% increase a year ago.
The price of petrol rose from 111p in June to 111.8p a litre in July, while the cost of diesel, climbed from 112.1p to 113p a litre over the period.
The ONS said the Retail Prices Index (RPI) - a separate measure of inflation, which includes housing costs - rose to 1.9% in July, up from 1.6% in June.