The seven-time Grand Slam champion and two-time US Open winner will next face Italian sixth seed Francesca Schiavone, the reigning French Open champion who ousted 20th-seeded Russian teen Anastasia Pavlyuchenkova 6-3, 6-0.
Williams has a 7-0 career record against Schiavone, but had to rally after losing the first set this year in winning at the Australian Open's round of 16 and the third round at Madrid.
Peer and Williams exchanged breaks in four consecutive games before the American held for a 5-4 lead in the first set.
In a marathon 12th game, Williams and Peer each missed on five game points before Peer held on a forehand winner to force the tie-breaker, where Williams grabbed a 5-1 advantage on the way to claiming the hard-fought set.
"Winning the first set always feels good," Williams said. "Instead of regrouping and figuring out how you are going to win the match, you can focus on trying to win it in the second set."
Williams broke in the third and seventh games of the second set, the latter on a drop volley winner after another extended fight in blustery winds.
Peer broke back in the eighth game when Williams hit a forehand wide but Williams broke in the final game, winning after one hour 54 minutes when Peer hit a backhand wide.
"She played so well and in these conditions it was very tough."