The UK economy grew by 0.6% in the three months to September, with warm weather boosting consumer spending, the Office for National Statistics said.
The figure for the third quarter is in line with predictions from the Bank of England and other forecasters.
However, buoyant growth in July was offset by a slowdown in August and September.
It is the highest quarterly growth figure since the fourth quarter of 2016, when the economy grew 0.7%.
Analysts warned the economy had "little underlying momentum" and growth would decline in the final three months.
The ONS also issued a separate monthly figure for September, which, like the previous month, showed zero growth.
Services, which make up three-quarters of the economy, only grew by 0.3% in the three months to September.
After a slow start to the year, construction activity grew by 2.1% in the quarter. Manufacturing also picked up after a slow second quarter, thanks to strong car manufacturing numbers for the quarter.
Household spending grew by 0.5% in the quarter, but business investment shrank by 1.2%, suggesting uncertainty among companies over the effects of Brexit.
Business investment had been expected to rise by 0.2%, according to forecasts. It has now contracted for three quarters in a row.
Simon Jack, business editor
The overall picture is one of an economy still recovering from an exceptionally weak, weather-affected start to the year. Construction and energy production both had a strong quarter and the weather played its part again in July, as sunshine and the World Cup boosted consumer spending. It's the strongest quarter for nearly two years, but the economy didn't keep up the strong momentum of July, with August and September registering no additional growth at all.
Worryingly but perhaps not surprisingly, business investment was down sharply, matching anecdotal evidence of firms' caution ahead of Brexit. Although car production was up compared with the second quarter of this year, it is down compared with the same period last year and domestic car sales were very weak - it's exports that are keeping the car industry ticking over.
Plenty for the chancellor to be cheerful about today, but a third quarter of falling business investment - the first time that's happened since the financial crisis - shows that firms think the sun may be shining now, but big clouds are looming.
'Signs of weakness'
Chancellor Philip Hammond said: "Today's positive growth of 0.6% is proof of the underlying strength in our economy. We are building an economy that works for everyone, with 3.3 million more people in work, lower unemployment in every part of the country, and wages rising at their fastest pace in almost a decade."
ONS head of national accounts Rob Kent-Smith said: "The economy saw a strong summer, although longer-term economic growth remained subdued. There are some signs of weakness in September, with slowing retail sales and a fallback in domestic car purchases.
"However, car manufacture for export grew across the quarter, boosting factory output. Meanwhile, imports of cars dropped substantially, helping to improve Britain's trade balance."
Samuel Tombs, chief UK economist at Pantheon Macroeconomics, said: "Two consecutive months of stagnation in GDP underline that the economy has little momentum and that the strong quarter-on-quarter growth rate simply reflects the weather-related rebound in the summer.
"The expenditure breakdown of GDP, meanwhile, shows that business investment fell by 1.2% quarter-on-quarter in Q3, taking the total decline since the peak in Q4 2017 to 2.4%. The risk of a no-deal Brexit is the clear driver of the downturn."
Suren Thiru, head of economics at the British Chambers of Commerce, said: "It remains likely that the stronger growth recorded in the third quarter is a one-off for the UK economy, with persistent Brexit uncertainty and the financial squeeze on consumers and businesses likely to weigh increasingly on economic activity in the coming quarters."