Analysts polled by Dow Jones Newswires had forecast a much more modest seasonally-adjusted increase of 1.7 percent from May, but economists agree that the indicator is volatile and subject to frequent revisions.
A statement issued by the Destatis national statistics office also noted that the result was affected by a change in the sample of companies that were polled.
The increase was still a sharp rebound from the month-on-month fall of 2.5 percent in May, however.
"While the May number was the worst in the last 10 years, the June number is the highest since 2007," Commerzbank analyst Ulrike Rondorf noted.
On a 12-month basis, retail sales fell by 1.0 percent in June, but Destatis noted there were 24 business days in June 2011, compared with 26 in June 2010.
ING senior economist Carsten Brzeski felt the data "show that German consumers are finally waking up."
"Of course, the rather discouraging track record of German retail sales is reason enough not to get overly excited," Brzeski added.
The figures nonetheless "offer some glimmer of hope that at least the German economy is heading towards a soft, not hard, landing," he said.
On a quarterly comparison, retail sales from April through June were 0.4 percent lower than in the first quarter, which Rondorf said "supports our expectation that German growth slowed considerably in the second quarter."
In the six months from January through June meanwhile, sales gained 1.3 percent from the same period a year earlier, Destatis said.
German retail federation HDE has forecast an annualised gain of 1.5 percent for 2011 as a whole, but HDE president Josef Sankjohanser noted recently that "the traditionally strongest months for retail sales still lie ahead."