Online spending bolstered UK retail sales last month, while department stores notched up their first increase this year, as consumers shrugged off Brexit fears.

The quantity of goods bought rose 0.2% in July, buoyed by the annual Amazon Prime Day, according to the Office for National Statistics. The figures wrong-footed City economists who had expected a 0.2% decline.

Spend, spend, spend: spirit of Viv Nicholson lives on among shoppers | Larry Elliott Read more

In the three months to July, retail sales rose by 0.5% when compared with the previous three months, down from 0.7% growth previously.

Rhian Murphy, the ONS head of retail sales, said increased only modestly in the past three months. “Although still declining across the quarter, there was an increase in sales for department stores in July for the first time this year,” she said. “Strong online sales growth on the month was driven by promotions.”

Non-store retailing, such as internet shopping and mail-order purchases, jumped by 6.9% last month, the biggest increase since May 2016. Amazon held its Prime Day summer sale on 15 July and other retailers also offered price reductions.

Quick guide Why are UK high street retailers in trouble? Show Hide What’s the problem? Physical retailers have been hit by a combination of changing habits, rising costs and broader economic problems as well as unseasonable weather. In the past few years names such as Mothercare, Karen Millen, Toys R Us, Maplin and Poundworld have disappeared from the UK high street as a result. In terms of habits, shoppers are switching to buying online. Companies such as Amazon have an unfair advantage because they have a lower business rate bill, which holds down costs and enables online retailers to woo shoppers with low prices. Business rates are taxes, based on the value of commercial property, that are imposed on traditional retailers with physical stores. At the same time, there is a move away from buying "stuff" as more people live in smaller homes and rent rather than buy. Uncertainty about the economy has also slowed the housing market and linked makeovers of homes. Those pressures have come just as rising labour and product costs, partly fuelled by Brexit, have coincided with economic and political uncertainty that has dampened consumer confidence. What help do retailers need? Retailers with a high street presence want the government to change business rates to even up the tax burden with online players and to adapt more quickly to the rapidly changing market. They also want more political certainty as the potential for a no-deal Brexit means some are not only incurring additional costs for stockpiling goods but are unsure about the impact of tariffs at the end of this year. Retailers also want more investment in town centres to help them adapt to changing trends, as well as a cut to high parking charges, which they say put off shoppers. What is the government doing? In the December 2019 Queen's speech, the government announced plans for further reform of business rates including more frequent revaluations and increasing the discount for small retailers, pubs, cinemas and music venues to 50% from one-third. It has also set up a £675m "future high streets fund" under which local councils can bid for up to £25m towards regeneration projects such as refurbishing local historic buildings and improving transport links. The fund will also pay for the creation of a high street taskforce to provide expertise and hands-on support to local areas. What is the outlook in 2020? Some retailers could go under. Weakened by a difficult Christmas – which accounts for the entire annual profits of many retailers, and with further potential Brexit wobbles to come – retailers are facing another tough year in 2020. The latest rise in the national minimum wage in April will also add to costs and hit profits. On the plus side, there are hopes of a boost to the housing market from increased certainty about Brexit after the general election. There are also signs that the shift to online shopping is slowing, potentially easing the pressure on high streets. Sarah Butler Photograph: Matthew Horwood/Getty Images Europe

The high street is being rocked by a long-term shift in shopping habits, as consumers increasingly shop online rather than visit local stores. One bright spot was the struggling department stores sector, where sales grew by 1.6% in July, ending six months of falls.

Elsewhere, the picture was less rosy. Food sales were flat, clothing and shoe shops recorded a 0.2% drop and household goods sellers suffered a 5.4% decline, reflecting the weaker housing market.

Facebook Twitter Pinterest Retail sales Photograph: ONS

Samuel Tombs, the chief UK economist at the consultancy Pantheon Macroeconomics, said the figures demonstrated that consumers were not fazed by the Brexit deadline. Retail sales had also risen in June, by 1%.

“Granted, Amazon’s Prime Day, which the retailer has run every July since 2015, probably was chiefly responsible for the colossal 6.9% month-to-month rise in non-store sales, which made a 0.7 percentage-point contribution to growth in total sales,” he said.

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

“Sales volumes likely will fall back in August, given that some shoppers probably brought forward planned purchases to take advantage of the temporary discounts offered by Amazon. Nonetheless, we still think consumers can be relied upon to steady the ship.”

Others said consumer spending also got a lift from the heatwave in July, and were sceptical that consumers would keep spending as much, as the 31 October Brexit deadline moved closer.

Gabriella Dickens, the assistant economist at Capital Economics, predicted household spending would hold up as long as a no-deal Brexit could be avoided. “The outlook further ahead depends on what happens with Brexit. If there is a no deal Brexit, consumer spending growth would probably fall,” she said.