It was the economy’s sixth consecutive month of growth, but the increase was much lower than in the previous month, which saw 1% growth.
Arts, entertainment and recreation activities helped the rise, but the “pingdemic” kept many workers at home.
The ONS said there had been a boost from outdoor events such as sports clubs, amusement parks and festivals following the easing of restrictions on social distancing on 19 July in England.
However, the main contributor to growth was a 1.2% rise in production output, boosted by the reopening of an oil field production site, which was previously temporarily closed for planned maintenance.
Jonathan Athow, deputy statistician of the ONS, said: “Oil and gas provided the strongest boost, having partially bounced back after summer maintenance. Car production also continued to recover from recent component shortages.”
Many firms suffered from a lack of staff during July as workers were forced to self-isolate at home after being alerted by the NHS Test and Trace app, giving rise to what was dubbed the “pingdemic”.
Construction has been affected by a shortage of building materials as prices have soared and supply has failed to match demand.
Overall, GDP grew by 3.6% in the three months to July, the ONS said.
The latest figures will weigh on the minds of Bank of England policymakers, who must ponder the implications for UK monetary policy.
On Wednesday, Bank governor Andrew Bailey said the UK’s economic bounce-back from the pandemic was showing signs of “levelling off”, but he maintained the view that rising inflation would not turn out to be persistent.
Prof Jagjit Chadha, director of the National Institute of Economic and Social Research, told the BBC’s Today programme that the increase for July was “lower than most people expected”.
Samuel Tombs of Pantheon Macroeconomics said the economic recovery had been “stopped in its tracks” by a surge in Covid cases in July.
He added that there were signs that the economy had regained momentum in August.
“Nonetheless, surveys continue to show that a large minority of households remain fearful of contracting Covid-19, even though they have been double-vaccinated.
“This suggests that the recovery in consumer-facing sectors might run out of steam again in the autumn if, as we expect, Covid-19 cases and hospital admissions remain on their current upward trend,” he said.
Kitty Ussher, chief economist at the Institute of Directors, said it appeared that “England’s thrilling run” in the Euro 2020 tournament had boosted growth in June, leading to “a bit of fall-back” in July.
Chancellor Rishi Sunak said the figures showed the recovery was “well under way”. But Labour’s Bridget Phillipson, shadow chief secretary to the Treasury, said “Conservative complacency” was “holding our country back”.