Germany's restaurants, bars, entertainment venues and gyms have been closed since Nov. 2 in an attempt to slow the pandemic's spread. Schools, factories and shops remain open with social distancing conditions.
Retail sales - a notoriously volatile indicator often subject to revisions - rose 2.6% month on month and 8.2% year on year in October in real terms, the Federal Statistics Office said. Both figures beat Reuters forecast.
The month on month data followed an upwardly revised drop of 1.9% in September and, compared with February - the month before the pandemic started in Germany - sales were 5.9% higher.
Demand was particularly strong for food, furnishings and household appliances.
The strong food sales could have been due to expectations of renewed lockdown measures which means more consumers are having meals at home, said economist Oliver Rakau from Oxford Economics.
Non-essential retail sales were likely to tumble in November, but online sales should hold up well, he added.
Online retailers continued to benefit from shifting consumer habits with a strong jump in sales, which came at the expense of clothing and shoe stores which suffered further losses.
The better-than-expected retail sales data followed bullish job market data which showed on Tuesday that unemployment fell further in November despite the partial lockdown.
But a gloomy consumer sentiment survey released by the GfK institute last week suggests the resilient labour market will not automatically translate into higher household spending at the end of the year.
Economic institutes expect Germany's gross domestic product to shrink by about 1% in the fourth quarter after a stronger-than-expected 8.5% rebound in the third and an unprecedented 9.8% plunge in the second quarter.
(Reporting by Michael Nienaber; Editing by Andrew Heavens and John Stonestreet)