Azarenka dominated play from the baseline and hit 20 winners.
"My game was more fluent than in the first round," Azarenka said. "My timing was better and I was less nervous. But I have to improve my serving as I had a couple of double-faults."
Azarenka, who has dropped only four games in two matches, will next play Petra Martic after the Croat defeated Patricia Mayr-Achleitner of Austria 6-2, 3-6, 6-0. Martic hit seven aces to reach her 10th career quarterfinal. Mayr-Achleitner won just five of 29 points in the deciding set.
The second-seeded Ivanovic had to dig deep against Petkovic, who has dropped to 192nd because of an injured right ankle. The German had been down an early break in the second set but rallied to make it 3-3 before losing.
"It was very tough. She is such a good player and it's good to see her back," Ivanovic said. "I am getting more consistent now. It's all about confidence."
Ivanovic, the 2008 and 2010 champion who has at least reached the quarterfinals all five times at the event, will take on Kirsten Flipkens. The Belgian defeated Mallory Burdette of the United States 4-6, 6-1, 7-5.
Burdette twice came back from a break down in the decider but missed two break-point chances at 6-5 to force a tiebreaker.
Bethanie Mattek-Sands reached her first quarterfinal of the season by defeating Carla Suarez Navarro of Spain 6-3, 6-3.
The 201st-ranked American is climbing back up the rankings after recent hip, back and left foot injuries. She will face next face Irina-Camelia Begu of Romania. Begu, who lost in qualifying but replaced Anna Tatishvili of Georgia in the main draw, beat Kiki Bertens of the Netherlands 6-4, 7-6 (7).