Inflation reached its highest level so far this year in April, when higher energy bills pushed up prices.
The Office for National Statistics said the Consumer Price Index was 2.1% in April, up from 1.9% in March.
That is above the 2% target set by the Bank of England but less than expected.
Computer games and package holiday prices helped to offset the impact of the higher energy bills, sparked by the rise in Ofgem's price cap on gas and electricity.
The ONS said electricity and gas prices rose between March and April 2019 by 10.9% and 9.3%, respectively.
"The upward movement partially reflected the response from energy providers to Ofgem's six-month energy price cap, which came into effect from 1 April 2019," the ONS said.
Last month, Ofgem raised the maximum prices that can be charged for gas and electricity to those who have not switched suppliers and are on default tariffs.
Air fares also pushed up the index, the ONS, said pointing to the late timing of Easter, with prices rising 26.4% on the month.
Prices fell in "recreation and culture" by 0.8% between March and April 2019, compared with a rise of 0.4% between the same two months of 2018. Prices of games, toys and hobbies fell, particularly computer games, the ONS said.
The 2.1% rise - to a high for the year - was less than the 2.2% increase that had been forecast by economists.
The measure of price rises had stood at 1.9% in both March and February, up from a two-year low of 1.8% in January.
The Bank of England said earlier this month that it was expecting growth and inflation to pick up over the next two years and that interest rate increases could be "more frequent" than expected.
Interest rates have been at 0.75% since last August.
Suren Thiru, head of economics at the British Chambers of Commerce, said there was little reason for the Bank of England's Monetary Policy Committee (MPC) to move rates soon.
"Rising inflation alongside slowing wage growth is a concern, as it squeezes real household incomes. If this trend continues, it could well choke off the recent improvement in consumer spending, a key driver of UK growth," he said.
"While consumer prices are likely to drift slightly higher in the near term, the outlook for inflation remains relatively subdued, with the current pressure on prices largely due to a number of temporary factors, such as rising energy costs."
Excluding bonuses, average weekly earnings for employees rose by 3.3% in the first three months of the year, when the comparable rate of inflation was 1.9%.
But Samuel Tombs, chief UK economist at Pantheon Macroeconomics, said the MPC could not be complacent about price rises and that he expects a rate rise in November.