The Office for National Statistics said sales grew by 1.4 per cent in July, much better than expectations for a 0.1 per cent rise.
It comes after retail sales suffered their sharpest fall in six months in June, contracting by 0.9 per cent from a month earlier, although the ONS said poor weather rather than Brexit was to blame.
Compared with the same time last year, July sales growth increased to 5.9 per cent. The latest reporting period accounted for the month following the EU referendum, covering the four-week period from July 3 to 30.
The weak pound is likely to have played a role in boosting sales, drawing tourists to the UK to buy luxury items like jewellery and watches, said Howard Archer, the chief UK and European economist for IHS Global Insight.
The Brexit vote has sent sterling into a tailspin, with the UK currency falling about 12 per cent since the result was announced.
Sterling immediately rose 0.4 per cent against the dollar on the back of the July retail figures, rising almost a cent and breaking through 1.31 US dollars.
Against the euro, the pound rose 0.2 per cent to 1.15.
Average store prices, including petrol stations, dropped by 2 per cent compared with a year earlier, and were down by 0.8 per cent from June.
However, the value of online sales increased by 16.7 per cent compared with last year and 1.2 per cent from a month earlier.
All sectors saw sales growth last month, but consumers spent more at non-food stores rather than supermarkets.
Paul Morales, a retail specialist at Lloyds Bank Commercial Banking, said: “Consumer spending habits have not fallen as sharply following the referendum as had been forecast by some.
“That being the case, retailers will be hoping that the current good weather holds, and that the feel-good factor being created by the Olympics translates to further spending on food and drink and Games-related merchandise.”
The better-than-expected figures are providing some hope for UK gross domestic product (GDP) in the months ahead.
“July’s jump in UK retail sales is a major boost to third quarter growth prospects,” Mr Archer said.
However, sustained growth will rely on other economic fundamentals, including employment and inflation rates.
“The concern remains that the fundamentals for consumers will soften appreciably over the coming months, thereby weighing down on spending. Consumers are likely to face less favourable purchasing power as inflation rises and earnings growth is limited by companies striving to limit their costs,” Mr Archer added.
The Bank of England more than halved its forecasts for household spending growth over the next two years after the vote to leave the EU.
It now expects growth in spending of 1 per cent and 0.75 per cent in 2017 and 2018 respectively due to lower growth in wages and higher inflation.