Total sales increased by 1.9%, according to the British Retail Consortium and KPMG's latest survey.
A separate report, by Barclaycard, showed that spending in restaurants, pubs and cinemas had also increased in the month following the vote.
However, Barclaycard found that overall spending fell by 1%.
David McCorquodale, head of retail at KPMG, said sunny days had "helped blow away some of the post-referendum blues, boosting the UK feelgood factor and giving consumers a sense that 'life goes on' following the initial shock of the Brexit vote".
He added that picnics and barbecues had helped lift sales of food and drink, while summer promotions and holiday preparations had helped boost fashion sales.
Helen Dickinson, the chief executive of the British Retail Consortium, said the rise was not surprising, given that "little has materially changed" for most UK households since the EU referendum.
A monthly report by Barclaycard, which processes nearly half of all the nation's credit and debit card transactions, found that consumer spending growth fell to 2.6% in July, down from 3.6% in May and June.
But the warmer weather may have played a part in a 12.2% increase in spending in pubs and a 12.8% rise in what card-holders spent in restaurants, it said.
There were some less positive results in the company's consumer confidence research, which found that Britons were more cautious about their future spending plans, with nearly 50% not confident in their ability to spend more on non-essential items.
Paul Lockstone, managing director at Barclaycard, said: "These are the first full month's figures since the EU referendum, so it's too early to say if this is the start of a long-term trend, but it seems likely consumers will be watching the external environment carefully ahead of any major spending decisions."
Warmer weather helped Britain's retailers sell more in July than during the same period last year, defying predictions of a post-Brexit slump.