On clay this year, Williams was 17-0 heading into the match with two titles. But she pulled out of her last match in the semifinals of the Italian Open with a bad back.
"I didn't feel anything abnormal," Williams said when asked about the injury. "I was 100 percent healthy."
Razzano jumped out to a 5-0 lead in the third set, but Williams won three straight games before what turned out to be an epic, 23-minute ninth game.
Williams had five break points in that final game.
"I was just thinking, if I can break here we'll be back on serve," Williams said. "You know, those are the kind of things that are going through your head."
Razzano saved all five, however, then converted her eighth match point to eliminate one of the tournament favorites.
"I had to dig deep against a great champion and you could see until the end that she gave away nothing," Razzano said. "I had to go and get the victory. I had to be mentally strong, and I gave my everything."
Razzano's coach and fiance, Stephane Vidal, died about a week before last year's French Open. Razzano played anyway, and lost in the first round.
Earlier, Rafael Nadal began his quest for a record seventh French Open title in style, wearing a pink shirt and pink shoelaces.
The second-seeded Spaniard had little trouble against Simone Bolelli of Italy, winning, 6-2, 6-2, 6-1 on, Court Philippe Chatrier - the same stadium where Nadal has won six of his 10 Grand Slam titles.
Nadal, who is tied with Bjorn Borg with six French Open titles, improved his record to 46-1 at Roland Garros. His only loss came in the fourth round in 2009, against Robin Soderling.
Fourth-seeded Andy Murray also advanced, beating Tatsuma Ito of Japan, 6-1, 7-5, 6-0.
Maria Sharapova was nearly perfect in her match against Alexandra Cadantu of Romania, winning all 12 games to produce a "double bagel." Wimbledon champion Petra Kvitova advanced by beating junior Wimbledon champion Ashleigh Barty, 6-1, 6-2.