(Sharecast News) - The UK economy unexpectedly grew in July, according to figures released on Friday by the Office for National Statistics.

The economy expanded by 0.4% in July, beating expectations for no growth. This followed 0.3% growth in June and no growth in May.

Services growth was 0.4%, while production and construction saw growth of 0.2% and of 0.1%, respectively.

In the three months to July, the economy grew 0.4% compared with the previous three months.

ONS director of economic statistics Liz McKeown said: "Growth remained relatively robust in the latest three months, as ongoing strength in the services sector was only partially offset by falls in both production and construction.

"Within services, computer programming was the largest contributor, continuing the strong growth seen throughout the year, with evidence that businesses involved with AI and related technologies helped to boost this sector.

"Continuing recent trends, research and development and rental and leasing also helped drive growth, while wholesaling saw a notable fall.

"Looking at the latest month, services also drove growth in July, with computer programming again making the largest contribution. Separately, as in June, some businesses reported that the warm weather and FIFA World Cup had affected their activity, although effects differed across industries, benefitting some businesses while creating challenges for others."

Barret Kupelian, chief economist at PwC, said: "The UK economy's mini growth spurt in the first half of the year spilled over into July, fuelled by the World Cup and hot weather. But growth appeared unbalanced with momentum in the largest services sector offsetting contraction in the smaller construction and the production sectors.

"Artificial intelligence continues to have imprints across the UK economy, with AI exposed sectors - professional services, information technology, administrative services - recording strong growth. For example, computer programming, consultancy and related activities have grown by more than 25% over the past two and a half years.

"The bigger question is whether this momentum survives into the autumn. At present, the most immediate risk is home grown: speculation ahead of the Budget. If uncertainty encourages businesses to postpone investment and households to defer spending, talk about the Budget could start affecting the economy before the Chancellor has even stood up to deliver it."