Stockpiling by manufacturers ahead of Brexit helped the UK economy grow by 0.3% in the three months to February.
The Office for National Statistics pointed to manufacturers "changing the timing of their activities" as the UK's exit from the EU approaches.
Although growth was stronger than the 0.2% many economists forecast, Rob Kent-Smith, head of GDP at the ONS, said growth "remained modest".
On a monthly measure, the economy grew by 0.2%, faster than the 0% forecast.
The 0.3% rise in the three months to February, was the same as the three months to January, after previous estimate was revised higher.
"Services again drove the economy, with a continued strong performance in IT. Manufacturing also continued to recover after weakness at the end of last year with the often-erratic pharmaceutical industry, chemicals and alcohol performing well in recent months," said Mr Kent-Smith.
Output in production and manufacturing rose for the second month in a row, with manufacturing at its highest level since April 2008, the ONS said.
The ONS said production industries expanded by 0.2% in the three months to February 2019. This was the first positive three-month growth since October 2018.
Impact of stockpiling
It said there had been external evidence "that some manufacturing businesses have changed the timing of their activity as we approached the original planned date for the UK's departure from the European Union".
"Although the ONS does not routinely collect detailed data on the reasons behind the behaviour of businesses, as part of our survey validation we have found some qualitative evidence that supported this view but were unable to quantify its impact," it added.
The ONS pointed to a closely-watched survey by IHS Markit/CIPS which showed UK factories were stockpiling goods for Brexit.
Lola's Cupcakes is one company which decided it needed to build up stocks of essential items ahead of Brexit.
In its case, it was cream cheese.
Asher Budwig, managing director, said the company had identified the ingredient as one at risk from Brexit. Others might have been chocolate or butter.
There would be "no cheese cakes, no decorations on cupcakes" if ferries stopped getting through ports, he told BBC.
The company bought £35,000 of stock - that does not include storage costs - through its supplier which obtains the product from Germany.
"They [the supplier] spoke to the factory in Germany, they produced a lot more, ten times what we would normally go through in a given week," he said.
"It's being held down in Somerset," he said.
Month-on-month growth in the industrial production sector was 0.6% in February, with manufacturing increasing 0.9%, the ONS said.
Samuel Tombs, chief UK economist at Pantheon Macroeconomics, said the activity in this sector was the main reason the economy had grown more quickly than expected.
He said this might be "due to a temporary boost to production which will unwind" in the second quarter of the year.
Construction output also rose faster than expected, perhaps because of the warmer than usual weather in February, he added.
Ruth Gregory, senior UK economist at Capital Economics, also highlighted these areas as the main surprises in the data.
But she said: "Growth does not appear to have been significantly boosted by stockpiling ahead of Brexit."
Instead, she said that while businesses have been stockpiling it is because they have been importing more. Imports rose by 5.3% in the three months to February while exports rose just 0.8%, according to the ONS.
She said: "Admittedly, the Brexit chaos may have sapped the economy of its momentum in March, as that is when the Brexit uncertainty has been greatest.
"All told, though, the solid growth rate in the three months to February should ease immediate fears of the economy stalling or contracting in the first quarter and provides support to our view that the economy is well placed to cope with whatever Brexit throws up next," she said.
Mr Tombs said he was revising up his forecast for growth in the first quarter to 0.4% from 0.3%, which indicates annual growth of between 1.8% and 2%. This could point to a rate rise from the Bank of England's Monetary Policy Committee.
"So the data, together with strong wage growth, put renewed pressure on the MPC to follow through on its commitment to an 'ongoing tightening of monetary policy', despite continued Brexit uncertainty," he said.