Gross domestic product increased by 0.3 per cent month-on-month in March, the Office for National Statistics (ONS) said, against expectations in a Reuters poll of economists for a 0.2 per cent contraction.
The services sector, construction output and manufacturing grew strongly.
For the first quarter as a whole, the economy expanded by 0.6 per cent - marking the third year running of conspicuously strong growth in the first quarter.
Economists said measurement issues related to shifts in spending after the pandemic might be contributing to that pattern.
Raj Badiani, economics director at S&P Global Market Intelligence, said the stockpiling of goods sparked by the Iran war might also have pulled forward demand in March.
"Nevertheless, recession risks have risen, and we now expect the UK economy to contract mildly in the second and third quarters of this year," Badiani said, citing a coming inflation surge caused by higher oil prices, and pressure on the Bank of England to raise interest rates.
The ONS said partial spending data for April "pointed to some weakening going into the second quarter".
It remains to be seen how renewed uncertainty in Westminster - with investors now unsure about the political future of Prime Minister Keir Starmer - will weigh on the economic outlook.
The ONS on Thursday published a blog that acknowledged there might be post-pandemic shifts in the timing of spending in the economy and said it was keeping its methods under review.
It nudged down its growth estimates for the first quarters of 2024 and 2025 as a result.
"It seems that something's not quite right with the way the data is being seasonally adjusted, a legacy we suspect of higher inflation and the timing of annual price hikes," said ING economist James Smith.
"Today's data won't change much for the Bank of England, which is singularly focused on the impending inflation spike and the risk of it spilling into wage growth."
A Reuters poll of economists showed the Bank of England will hold borrowing costs at 3.75 per cent in 2026, though more than a third expect at least one rate hike as the Iran war fuels an energy price surge that drove up inflation forecasts.
Financial markets, by contrast, have priced in between two and three quarter-point rises in 2026.
Finance minister Rachel Reeves said the data showed she had the right economic plan.