The Federal Statistics Office said seasonally adjusted exports rose 0.7% on the month while imports fell 1.5%. The trade surplus rose to 20.2 billion euros ($22.27 billion) after a downwardly revised 18.0 billion euros in the prior month.
A Reuters poll of economists had pointed to a 0.5% drop in exports and a 0.3% fall in imports. The trade surplus was expected to come in at 17.5 billion euros.
"This morning's trade data brings a very weak ray of sunshine. Nothing more but luckily also nothing less," said Carsten Brzeski, economist at ING.
The stronger-than-expected export figures cut against the grain of a recent run of weak data from Germany, which has fuelled concerns that the economy could tip into recession in the July-September period.
Against that bleak backdrop, the European Central Bank is expected to deploy fresh stimulus at its policy meeting on Thursday.