The Swiss player came through 6-4 6-3 after one hour and 22 minutes of tennis.
Federer began the match strongly, breaking Gasquet in the third game to open up a two-game lead.
The Frenchman enjoyed a break of his own in the eighth game, but Federer responded instantly, breaking the Gasquet serve in the next game before serving out the opening set.
Gasquet made several unforced errors in the opening game of the second set, which allowed Federer to break.
In a dramatic final game, Gasquet saved five match points before hitting a tame forehand into the net to give Federer the victory, which moves him to the top of the group.