STANFORD, Calif. (AP) -- Serena Williams knows all about coming back from injury, illness and disappointment. She also knows how to compete, which may be her biggest asset.
Williams roared back after falling behind in the third set to beat Ana Ivanovic 2-6, 6-3, 7-5 on Friday night to reach the semifinals of the Bank of the West Classic.
''She's not easy to play. She always gives 100 percent,'' Williams said. ''I just kept fighting, stayed calm and focused on what I wanted to do.''
The top-seeded and top-ranked Williams dropped three consecutive games to fall behind 4-3 and then ripped seven straight points to right the ship in front of a sellout crowd at Stanford.
''I think I can play loads better and that's good that I believe that,'' Williams said. ''I thought we both played very well.''
Williams is assured of a 200th non-consecutive week at the top of the ladder while Ivanovic will return to the top 10 for first time in over five years.
''It feels great to be back in the top 10,'' Ivanovic said. ''I've worked so hard to get back. I've set high goals for myself and this was the first one.''
Ivanovic took an injury timeout down 5-2 in the second set. She pinched a nerve in her left side when came down after a winning shot. It's the same thing that cropped up at the beginning of the year.
''It made it hard to move to the right but she was playing well at that time and using the angles,'' Ivanovic said. ''Playing the No.1 player in the world that close and having opportunities was encouraging.''
She gets a shot at Serena Williams on Saturday afternoon.
''You don't ever have the feeling you have something under control when you play either of them,'' Petkovic said. ''They can hit so hard, and play consistently well. You always have to be on your toes.''
Following a shaky start, the 25th-ranked Williams picked up her game in the second set and appeared poised to take over the match.
The 18th-ranked Petkovic rallied in the third set, taking leads of 3-1 and 5-3, to beat Williams in their first meeting since Luxembourg in 2012.
''I was not as on as I was on previous days,'' Williams said. ''I had to fight through that and I think I almost did that. But she played the last two points better.''
Petkovic, making her debut in the tournament, is looking for her third title of the season. She also reached the semifinal at the French Open.
''I played one of my best games in the third set at 5-5,'' Petkovic said. ''Before that it was a weird match. There were so many momentum changes and so many ups and downs, I felt like I played four different matches in one.''
The Serena-Ana match was similar as Ivanovic dominated the first set before Williams turned it around in the second set.
The third set took on a life of its' own. Both players simply refused to go away and battled through long rallies and silly errors.
Serena served for the match at 5-4 but Ivanovic denied her. Serena broke back and used a pair of aces to take a 40-0 lead before ending it when Ivanovic's return went just wide.
Varvara Lepchenko took care of qualifier Sachia Vickery, 6-1, 6-0, to earn her 400th career win, which includes all levels.
''It was hard to play someone from the United States who I know very well,'' Lepchenko said. ''I've practiced with her often before. I knew this match would be mentally tough but was just trying to play the best tennis I could.''
She will meet third-seeded Angelique Kerber in Saturday night's semifinal. Kerber topped Garbine Muguruza, 6-2, 6-1.
''She is definitely one of the tougher lefty opponents out there, so I will have to play and fight for every single point,'' Lepchenko said. ''I'm going to stay focused on my game and hopefully things will work out well for me.''