UK consumer price inflation remained at 3% in January, the same level as in December.
The rate, as reported by the Office for National Statistics (ONS), is close to November’s six-year high of 3.1%.
Most economists were expecting a small fall in the CPI to 2.9%.
Last week, the Bank of England indicated interest rates might rise sooner than expected when it said it wanted to get inflation closer to 2% within two years rather than three.
Investors have been pricing in a good chance that rates would rise in May, with a second rise later this year, probably in November.
Interest rates are currently at 0.5%. If the Bank raised rates in line with market expectations, they would reach 1% by the end of this year.
The ONS said that although petrol prices had risen by less than this time last year, the cost of entry to attractions such as zoos and gardens fell more slowly.
It said, however, that after rising strongly since the middle of 2016, food price inflation now appeared to be slowing.
ONS senior statistician James Tucker said: “Factory goods price inflation continued to slow, with food prices falling in January. The growth in the cost of raw materials also slowed, with the prices of some imported materials falling.”
Inflation was given a steep boost by the UK’s vote in 2016 to leave the European Union.
It prompted a fall in the pound, making imported goods more expensive.
Chris Williamson, chief economist at Markit, said: “UK inflation came in higher than expected in January, adding further pressure for policymakers to hike interest rates again, possibly as soon as May.
“However, with mounting signs of economic growth slowing at the start of 2018, a May rate rise is by no means a done deal and will likely be dependent on the data flow improving in coming months.”
Samuel Tombs, chief UK economist at Pantheon Macroeconomics, said that data was likely to show inflationary pressures easing: “CPI inflation still looks set to fall sharply this year, as the anniversaries of sharp sterling-related rises in core goods, food and energy prices are met.
“The fall back in oil prices to $63, from $70 in mid-January, also has brightened the near-term outlook.”
He said this gave the Bank of England “more scope than it currently envisages to delay the next rate hike”.
Mel Stride, the Financial Secretary to the Treasury, said: “The good news is that inflation is expected to fall this year. We are helping cut costs for hard pressed families by boosting pay, cutting taxes for millions of people and freezing fuel duty at the pumps.”
The ONS reports a number of different inflation measures.
It said the Retail Prices Index (RPI), which is used to calculate payments on government bonds, student loans and other commercial contracts, edged down to 4% from December’s six-year high of 4.1%.
Its own preferred measure, CPIH, which includes housing costs, remained at 2.7% in January, also unchanged from December.