The economy grew 0.3% in July, the UK's official statistics body said, helped by the dominant services sector.
Growth was flat over the three months to July, but this was an improvement on the 0.2% contraction seen in the April-to-June quarter.
This contraction, coupled with some weak business surveys, raised concerns the UK was heading for recession.
An economy is generally deemed to be in recession if it contracts for two quarters in a row.
However, while growth in the services sector - which accounts for about 80% of the UK economy - helped to drive July's stronger-than-expected growth figure, the Office for National Statistics (ONS) warned that the sector remained weak.
"While the largest part of the economy, the services sector, returned to growth in the month of July, the underlying picture shows services growth weakening through 2019," the ONS said.
The British Chambers of Commerce (BCC) also said that concerns remained.
"Although there was a rise in GDP between June and July, the zero growth recorded on the underlying three-month measure points to an economy under pressure from uncertainty over Brexit and weakening global economic conditions," said Suren Thiru, head of economics at the BCC.
"The manufacturing sector remains an area of concern, with tightening cash-flow, concerns over disrupted supply chains and weakening demand in key markets weighing on activity in the sector."