The 17-time Grand Slam winner was pushed all the way by the 2011 Halle champion before clinching a second round matchup against either Ernests Gulbis or Sergiy Stakhovsky after just over two hours on centre-court.
Federer has reached the final of the last nine editions of the grasscourt Wimbledon tune-up, winning seven, but was given an almighty scare by the 31-year-old world number 28 who reached the Wimbledon quarterfinals in 2012.
There was more luck for German players elsewhere in the draw, as Florian Mayer, Alexander Zeverev and Dustin Brown all advanced.
Mayer is now one match away from reaching the Halle quarterfinals for a fifth time following a 6-2, 0-6, 7-6 (7/4) win over German wildcard Jan-Lennard Struff.
“On grass, it’s all about one or two points,” said Mayer.
“I could have won 6-3 in the third, then he played a few amazing points and suddenly it’s 5-4, 15-30 on my serve. He hit a return with the frame right on the line and almost had match point. I could also have lost 6-4,” he added.