After losing the second set and being down 5-3 in the final set, Federer prevailed 7-6, 3-6, 7-6 in match that required two tie breaks.
Along the way the Basel native made a few dramatic shots, including a behind the back lob, on Halle's grass centre court, where the tournament is seen as a warmup for Wimbledon.
Federer, 33, has won seven titles at the German venue and is aiming for an eighth win at the All England Tennis Club.
The 17-time Grand Slam winner was pushed all the way by Kohlschreiber, 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 Halle tournament, but was given an almighty scare by the 31-year-old world number 28, who reached the Wimbledon quarterfinals in 2012.
German players elsewhere in the draw had more luck, as Florian Mayer, Alexander Zeverev and Dustin Brown all advanced.