It was anything but easy for the 33-year-old Williams, who won the tournament a decade ago but has struggled with health issues in recent years.
She trailed 3-1 in the opening set then 4-1 in the second but fought back each time to seal victory in an hour and 50 minutes.
“She was playing so well, but good thing is that when I get behind, I give even more effort and get even more focused,” Williams told reporters.
“(Playing from behind) is something you really have to do to win big matches.”
The next opponent for Williams is rising Canadian star Eugenie Bouchard.
The biggest surprise on Wednesday was the defeat of Sloane Stephens. Seeded fifth, she fell to a 6-4 6-4 loss to Ukrainian teenager Elina Svitolina.
“I was waiting for this win a long time,” said the 19-year-old Svitolina.
“I’ve been working hard and believing in myself, so I was waiting for this win.”
Stephens was philosophical about her loss.
“I didn’t play that bad, I didn’t think so, but obviously she played pretty well,” said the American.
“It’s just unfortunate that I lost, but I mean, you can just learn from the mistakes and things like that and build on it.”
With Serena and now Stephens out of the tournament, just three of the top five seeds remain in the event.
Serbia’s Jelena Jankovic, the second seed and 2007 champion, easily beat American Lauren Davis 6-0 6-3 while Italian third seed Sara Errani cruised into the third round when she won the first set against Kiki Bertens after her Dutch rival retired.
The fourth seed, Germany’s 2009 champion Sabine Lisicki, had a much tougher time against American Vania King but survived 7-5 4-6 6-3.
(Reporting by Jahmal Corner in Los Angeles; editing by Julian Linden)