The 35-year-old, who is bidding for a record eighth title at Wimbledon next month, won 6-4 7-6 (7-5) in Halle.
Khachanov missed two set points to take the match into a decider, with Federer hanging on before taking the tie-break.
The Swiss top seed will play either Germany's Alexander Zverev or France's Richard Gasquet in today's final.
Eighteen-time Grand Slam winner Federer lost to 39-year-old Tommy Haas at the Stuttgart Open last week, his first match in two months, but is yet to drop a set as he bids for a ninth title at Halle.
However, he was given a stern test by 21-year-old Khachanov in their first meeting.
While Federer is considered one of the greatest grass-court players of all time, 38th-ranked Khachanov was playing in his first tournament on the surface.
Federer took an early advantage after the opening three games all produced breaks of serve, going on to seal the first set at the second attempt before Khachanov pushed him in another tight set.
Federer took his opponent's serve for 5-4, leaving the world number five serving for the match, only for Khachanov to break back and level.
After missing his chances to win the set at 6-5, Khachanov fought back from two mini-breaks in the tie-break, but fired long after his own serve on match point.
Federer has already won three title titles this season, including the Australian Open - his first Grand Slam success in five years.
Federer also won the BNP Paribas Open at Indian Wells in March and, two weeks later, the Miami Open.
In May, he announced he would be missing the French Open and the rest of the clay-court season to concentrate on the grass and hard-court seasons.
Another success at Wimbledon will put Federer clear of Pete Sampras' joint-record seven men's singles victories in SW19.