It is the third month in a row that the economy has expanded.
But the Office for National Statistics (ONS) said that the UK "has still only recovered just over half of the lost output caused by the coronavirus".
Hairdressers, pubs and restaurants contributed to growth after companies were allowed to reopen in July.
However, the UK's economy is still 11.7% smaller than it was in February and growth in July was slower than the 8.7% expansion seen in June.
Thomas Pugh, UK economist at Capital Economics, said the reopening of restaurants and pubs meant the accommodation and food services sector "rose by a whopping 140.8%" between June and July.
However, activity in this sector was 60.1% below the level recorded in February.
And while Mr Pugh expects the Eat Out to Help Out scheme to provide a further boost in August, "now that most sectors in the economy are open again there is little scope for further large rises in monthly GDP".
Up, up, but not away. The UK economy continued a sharp recovery from lockdown in July, growing by a bumper 6.6% in the month. But the rate of recovery was a little slower than in June, raising some concerns about the ongoing strength of the bounce back.
The economy is still nearly 12% smaller than before the pandemic crisis, and has recovered just over half of the lost output during the shutdowns.
While the third quarter is on course to see a record number for growth and the official end of recession, fears remain that the recovery could peter out.
Business groups continue to push for extensions to government support packages that are due to close. The figures in July reflected the partial reopening of retail, manufacturing, and some public sector activities such as schools.
The UK fell into recession after activity shrank for the first and second quarters of this year after the government announced a lockdown to stop the spread of the coronavirus.
Mr Pugh questioned how strong the UK's recovery would be throughout the rest of the year.
"Talk of tax rises at the next Budget, a further deterioration in the Brexit negotiations and a worrying rise in the number of virus cases and tighter social distancing restrictions will all conspire to slow the recovery even further," he said.
Dean Turner, economist at UBS Global Wealth Management, forecasts that it will take until the end of 2021 before the UK recovers to pre-pandemic levels.
"Even with a managed exit from the Brexit transition agreement, it is unlikely that the lost output would be recovered before the end of next year," he said.
"The latest twist in negotiations raises the prospect that any recovery may take longer."
Meanwhile, the Coronavirus Job Retention Scheme is due to end on 31 October.
Former prime minister Gordon Brown, warned that ending the furlough scheme was a "cliff-edge" that could trigger "a tsunami of unemployment".
"The government's got to change course here," he told the BBC's Today programme.
Mr Brown called on the government to introduce a short-time working scheme, such as those in France and Germany. This would allow firms to reduce employees' working hours while keeping them in jobs, with the state topping up their salaries.
"You have got to send a signal that unemployment matters," he said. "We don't want to destroy any more capacity and skills in the economy."
The reopening of pubs and restaurants in July boosted the alcohol industry by 32.7% while the car sector saw demand return to pre-pandemic levels.
"Car sales exceeded pre-crisis levels for the first time with showrooms having a particularly busy time," said Darren Morgan, director of economic statistics at the ONS.
"All areas of manufacturing, particularly distillers and car makers, saw improvements, while housebuilding also continued to recover."
Keeping youngsters occupied while at home also continued to boost demand for toys and games, said the ONS, while holidaying in the UK supported campsites, cottages and caravan parks "because of a large increase in staycations".
Hanging onto resentment is letting someone you despise live rent-free in your head.