The risks of the UK sliding into its first recession in a decade have receded after a stronger-than-expected and across-the-board 0.3% increase in activity in July.

Data from the Office for National Statistics showed that after a dismal spring and early summer all sectors of the economy registered growth in the third quarter’s first month.

Fears that Britain could slip into recession – two consecutive quarters of falling gross domestic product – had been stoked by the 0.2% decline in output in the three months to June.

Brexit recession fears ease as UK returns to growth in July - business live Read more

However, in July the services sector – which accounts for about 80% of the economy – grew by 0.3%, while the struggling manufacturing and construction sectors also bounced back, with increases in output of 0.3% and 0.5% respectively. The City had been braced for a smaller 0.1% increase in GDP in July

The ONS warned against reading too much into a single month’s data, noting that in the three months to July the economy showed no growth.

David Cheetham, the chief market analyst at XTB online trading, said: “Following a flat reading in June this is a positive surprise and the accompanying rise in manufacturing production is also pleasing.

“While the figures are far from stellar, after a contraction in the second quarter the chances that we see a negative GDP print in the third have now dropped significantly, meaning that a technical recession will likely be avoided.”

The course of the economy has been dominated by Brexit during 2019 so far.

Firms built up stocks of goods in the first quarter in the run-up to the initial 29 March deadline for the UK leaving the EU – but the boost to growth was temporary because the delay to Brexit meant firms then ran down their inventories.

The decision by the motor industry to bring forward its annual maintenance shutdown from August to April also contributed to the drop in activity in the second quarter but should provide a boost in the third quarter.

Sir Charlie Bean, a former deputy governor of the Bank of England, said he thought it “highly unlikely” that the UK economy continued to contract in the third quarter, meaning a pre-Brexit recession would be avoided.

Speaking to MPs on the commons Treasury committee, he said the fall in GDP in the second quarter was “affected by unusual circumstances around the original Brexit date”, such as the closure of car plants. He said that after the planned shutdowns, factories would likely have continued producing over the summer months: “That will lead to a bounce in the production figures for manufacturing in August when they come out. I’ll be surprised if the third quarter isn’t something like 0.3% or 0.4% [growth in GDP].”

There were also hints from the latest trade figures that the current Brexit deadline of 31 October is having an impact on activity.

Sign up to the daily Business Today email or follow Guardian Business on Twitter at @BusinessDesk

Paul Dales, the chief UK economist at Capital Economics, said the 0.3% rise in service-sector output in July followed four months of no change and was partly because of a 1.1% monthly increase in transport and storage output and a 1.6% jump in admin and support services output.

“That and the strong 2.5% and 2.7% monthly rises in the value of exports and imports respectively in July could be the first real signs that businesses are bringing activity forward ahead of the possible 31 October Brexit deadline,” Dales said.

The ONS said the UK’s trade was broadly in balance in July, with a goods deficit of £9.1bn offset by an £8.9bn services surplus. July’s £0.2bn shortfall was little changed on June’s £0.1bn deficit.

The National Institute for Economic and Social Research said it was pencilling in growth of 0.3% in the three months to September. Garry Young, its director of macroeconomic modelling and forecasting, said: “It looks like there has been a welcome resumption of economic growth in the third quarter, roughly offsetting the fall in the second quarter.”