The UK's key inflation rate remained steady in October at a five-and-a-half-year high of 3%, official figures show.
Higher food prices were offset by lower fuel costs, the Office for National Statistics (ONS) said.
The price of food and non-alcoholic drinks rose at an annual rate of 4.1%, the highest since September 2013.
The Consumer Prices Index (CPI) had been expected to rise, with the Bank of England forecasting it would peak at 3.2% this autumn.
The official target for the CPI is 2%.
If the CPI inflation rate had risen above 3%, Bank of England governor Mark Carney would have been forced to write to the chancellor explaining why it was so far above target.
Maike Currie at Fidelity International said Mr Carney could "breathe a sigh of relief this month".
However, she added: "While the Bank of England raised interest rates at the beginning of this month given concerns over inflation, it will take some time for inflation to fall back nearer the 2% target.
"This means cash-strapped consumers will continue to feel the pinch as wages lag price rises."
While food price inflation picked up last month, this was offset by the falling cost of motor fuel and lower furniture prices, the ONS said.
The fall in the value of the pound since last year's Brexit referendum has contributed to the recent rise in inflation, as it has increased the cost of imported goods and services.
However, Chris Williamson, chief business economist at IHS Markit, said the latest inflation figures "will add to the sense that the worst of this impact has already passed".
"Data on company costs, which tend to change ahead of changes in consumer prices, are already shown signs of having peaked earlier in the year," he added.
Earlier this month, Sainsbury's chief executive Mike Coupe said the UK was "probably through the worst" of food price rises following the slide in the pound.
Yael Selfin, chief economist at KPMG said the "relatively positive" news on inflation could prompt the Bank to plan fewer rate rises in the next two to three years.
"That may help support a vulnerable UK economy in the process of leaving the EU, but at the same time it could put further strain on savers and significant sectors of the economy such as banks and insurers, while stoking potential pockets of over-exuberant asset prices," she said.
October's Retail Prices Index (RPI), a separate measure of inflation, was 4%, up from 3.9% in September. Government index-linked savings products and some train ticket prices rise in line with RPI.
The ONS's preferred inflation measure of CPIH, which contains owner-occupiers' housing costs, was unchanged at 2.8%.