Cilic managed to hold his concentration and serve and rammed home the advantage with a double break to level the match.
This showdown ultimately hinged on the third set and it was the world No.47 who faltered on a double fault to direct the tiebreak in Federer’s favour.
Another double fault cost him dearly in the fourth as he conceded an early break and it was enough to sound his death knell as Federer pulled clear.
A third-round meeting with German world No.59 Dominik Koepfer is next for the No.3 seed and the chance to put his refurbished knee to the test again.
“For me, my knee, the good thing is that I got a lot of information out of a match like this,” Federer said. “We will keep on getting information tomorrow and the next day, so I hope I can back it up with another good match.
“And whatever the outcome is, I know it was definitely the right choice to come here to Paris, which I'm very happy about.”