- The rise in price growth from April's 1.5% was driven in large part by the comparison with prices in May 2020 when the country was in its first tight lockdown, especially for clothing, motor fuel, games and take-away food.
- A Reuters poll of economists had pointed to a rise in inflation to 1.8%.
British inflation unexpectedly jumped above the Bank of England's 2.0% target in May when it hit 2.1% and looks set to rise further as the country re-opens its economy after its coronavirus lockdowns.
The rise in price growth from April's 1.5% was driven in large part by the comparison with prices in May 2020 when the country was in its first tight lockdown, especially for clothing, motor fuel, games and take-away food.
A Reuters poll of economists had pointed to a rise in inflation to 1.8%.
Investors around the world are assessing the risks of a sustained jump in inflation, especially in the United States where annual inflation hit 5.0% in May, the highest in almost 13 years, and where U.S. President Joe Biden has proposed a $6 trillion stimulus package.
Jack Leslie, an economist at the Resolution Foundation think tank, said the speeding up of price growth from 0.3% in November to 2.1% in May represented the fastest six-month rise since sterling collapsed after the 2008-09 financial crisis.
"But UK inflationary pressures are different - and nowhere as near as large - as those causing fierce debate in the U.S.," Leslie said.
Sterling was little changed by the ONS figures.
The BoE has said it expects inflation to hit 2.5% by the end of this year as the economy reopens after its coronavirus lockdowns and as global oil prices rise.
Core inflation, which excludes the price of food, energy and other volatile items, rose to 2.0% in the 12 months to May, the Office for National Statistics said.
Governor Andrew Bailey and most colleagues say the increase in inflation will be temporary and does not require the central bank to scale back its huge stimulus programs. It is expected to leave policy unchanged on June 24 after its latest meeting.
But Chief Economist Andy Haldane said last week that the BoE's policymakers faced the "most dangerous moment" since 1992 when the government removed sterling from the European Exchange Rate Mechanism, a precursor to the euro.
There were signs of further price pressure ahead in Wednesday's data.
Prices paid by manufacturers for their inputs rose by 10.7% in the 12 months to May, the highest since September 2011, and the prices they charged rose by 4.6%, the biggest increase since January 2012.