Williams, an eight-time Grand Slam champion who is trying to win her second title at Roland Garros, took a 4-0 lead in the first set, but struggled at times in the second.
Roger Federer also advanced to the quarterfinals, beating No. 13 Mikhail Youzhny of Russia 7-6 (3), 6-4, 6-4. The top-ranked Swiss star tied the Grand Slam record for most consecutive sets won in the Open era, taking his streak to 35.
"I've got enough shirts for five-set matches in the bag," Federer said. "I only used one today."
Federer next faces No. 9 Tommy Robredo, who defeated No. 29 Filippo Volandri of Italy 6-2, 7-5, 6-1. Federer beat Robredo at the Australian Open.
Federer, trying to win his fourth consecutive major title and complete a career Grand Slam, also matched another Grand Slam mark with 11 straight-set victories in a row. John McEnroe set both records during Wimbledon and the U.S. Open in 1984.
"Maybe if I win first set, it would be something different," Youzhny said.
The 10th-seeded Safina broke Williams at love to even the second set at 3-3, but the American then won 12 of the last 14 points.