Retail sales outstripped expectations last month as inflation-squeezed shoppers spent more money on food.
The Office for National Statistics (ONS) said July sales rose by 0.3% in terms of quantity, in line with the month before and ahead of economists' predictions of 0.2%.
Growth was underpinned by surging food sales, which picked up by 1.5% over the period as other areas except household goods fell.
The pressure on household budgets was laid bare on Wednesday when total pay in real terms sank by 0.5% both including and excluding bonuses.
Despite holding steady at 2.6% last month, inflation remains above wage growth and the Bank of England's target of 2%.
Ole Black, ONS senior statistician, said: "The underlying trend at the beginning of 2017 showed a relatively subdued picture in retail sales.
"Strong food sales have been responsible for the growth of 0.3% in July compared with June, as all other main sectors have shown a decrease.
"Whilst the overall growth is the same as in June, trends in growth in different sectors are proving quite volatile."
Focusing on the past three months, sales slowed to 0.6% growth after accelerating to 1.5% in the second quarter of this year.
Online sales, which account for around 16% of retail spending, climbed by 15.1% annually and 0.3% on the month.
Average store prices, including petrol stations, rose by 2.7% month on month in July, while price tags on food picked up by 2.8%.
Ben Brettell, senior economist at Hargreaves Lansdown, said: "The UK consumer is extraordinarily resilient.
"Spending has defied expectations of a slowdown since the Brexit referendum, and currently seems to be holding up despite weak wage growth and above-target inflation.
"This could bode well for economic growth - the UK economy is heavily reliant on the consumer, and economists had expected falling real incomes to eventually translate into weak retail sales.
"If this fails to materialise, the economy could see a stronger second half to the year - though there are also growing concerns over the level of household debt, which is fuelling continued consumption in the absence of rising real wages."