Annual consumer price inflation rose to a three-month high of 2.1% in July from 2.0% in June, the Office for National Statistics said, bucking the average expectation in a Reuters poll of economists for a fall to 1.9%.
The older measure of retail price inflation - which this month will determine increases in many rail fares for 2020 - edged down to 2.8% from 2.9%, in line with forecasts.
Earlier this month the BoE predicted consumer price inflation would fall to a three-year low below 1.6% in the final quarter of this year, reflecting lower oil prices and government caps on household energy bills.
This is despite a sharp fall in the value of sterling, which has gathered pace since Boris Johnson became prime minister last month with the promise to take Britain out of the European Union on Oct. 31, even if that means leaving without a divorce deal.
Sterling weakened by 2.4% against a basket of major currencies in July, and this month the pound sank to its lowest since October 2016 <GBPTWI=BOEL>.
Businesses fear a no-deal Brexit will create major disruption at ports, further pushing up the cost of imports.
There was little immediate market reaction to the data, with analysts more focussed on the government's Brexit policy.
"Inflation remains near target, but continued depreciation of the pound could push it higher," Nancy Curtin, chief investment officer at Close Brothers Asset Management, said.
Inflation surged after sterling fell more than 10% in the wake of June 2016's referendum decision to leave the European Union, peaking at a five-year high of 3.1% in November 2017.
The ONS said it was too soon to be able to identify weaker sterling as the main factor behind July's rise in prices. Instead, higher costs for hotel rooms, video games and consoles, as well as less discounting of clothes in summer sales, increased the annual rate of inflation, it said.
RISING PRICE PRESSURE?
A Citi/YouGov survey of public inflation expectations on Monday showed the most elevated long-run expectations in six years, and the highest number of households unsure about the short-term direction for inflation since June 2016.
The BoE says underlying inflation pressures mean it is still likely to need to raise interest rates over the medium term, assuming Britain avoids major disruption on Oct. 31 and the global economy recovers.
Official data on Tuesday showed wage inflation hit an 11-year high of 3.7% in the second quarter, a pace which would normally prompt the BoE to tighten rates.
And Wednesday's figures showed a measure of core inflation, which excludes relatively the volatile prices of energy, fuel, alcohol and tobacco, rose to a six-month high of 1.9% versus forecasts for it to hold steady at 1.8%.
However, financial markets price in the BoE's next move as being a cut, given the risk of a no-deal Brexit which they believe would compel the BoE to offer economic stimulus.
The ONS figures also pointed to inflation pressures in the pipeline from rising costs for manufacturers.
Among manufacturers, the cost of raw materials - many of them imported - was 1.3% higher than in July 2018, beating all economists' forecasts in a Reuters poll and up from a rate of 0.3% in June.
Two thirds of these materials are imported, and increase in cost when sterling weakens, though the ONS said it could not identify a specific effect from a single month's data.
Manufacturers increased the prices they charged by 1.8% last month compared with 1.6% in June, again stronger than forecast.
Wednesday's data also showed that house prices rose by an annual 0.9% across the United Kingdom in June, unchanged from May and the joint-weakest increase since November 2012.
The year-on-year decline in house prices in London - which has been hardest hit by concerns about a disorderly Brexit - levelled off slightly to show a fall of 2.7% after a 3.1% drop in June which was the largest since September 2009.
(Editing by Janet Lawrence)
By David Milliken and Andy Bruce