MELBOURNE, Australia — Serena Williams avenged her worst Grand Slam defeat with a 2-6, 6-3, 6-2 win over Garbine Muguruza on Monday to reach the Australian Open quarterfinals.

The top-ranked Williams was pushed all the way by No. 24-seeded Muguruza, who matched her in the heavy-hitting rallies, and who conceded only four games to her in the second round of the French Open last year.

Williams appeared to be laboring at times and had a serious cough. She struggled with her serve in the first set, but found her range in the second.

She will next play Dominika Cibulkova, who reproduced the kind of tennis that helped her reach the final last year as she beat two-time champion Victoria Azarenka 6-2, 3-6, 6-3.

Under the closed roof at Rod Laver Arena, Cibulkova pounded 44 winners, including a dozen on her backhand side, and broke former No. 1-ranked Azarenka’s serve seven times Monday to reach a Grand Slam quarterfinal for the sixth time.

Azarenka, unseeded after her ranking slipped into the 40s following an injury-interrupted 2014, won Australian titles in 2012 and 2013 and reached the quarterfinals last year. She won the first two games before Cibulkova went on a six-game roll. Azarenka controlled the second set despite slipping twice to the court and was on level terms in the third until Cibulkova got the decisive break in the seventh game.

Cibulkova held to take a 5-3 lead, chasing a slice backhand into the corner and whipping a forehand cross court on game point, and then broke Azarenka’s serve again.

“I just walked onto the court and all great memories came to my mind,” she said, reflecting on how her run last year is inspiring her, “I thought ‘I’m a great player and I can do it.”’

Cibulkova used a powerful backhand to win important points in the first set, then relied on her backhand to maximum effect.

“As you can see, I’m not the tallest player on tour,” said Cibulkova, who is 5-foot-3. “I need to have something extra if I want to beat these top players. This is my energy on the court, this is how I play.”

Rain forced the roofs on all three stadium courts to be closed early, but they opened for later matches when the weather cleared.

Stan Wawrinka, the men’s defending champion, reached the quarterfinals with a 7-6 (2), 6-4, 4-6, 7-6 (8) win over Guillermo Garcia-Lopez.

Three-time Australian Open finalist Andy Murray also advanced, fending off Grigor Dimitrov 6-4, 6-7 (5), 6-3, 7-5. His next opponent will be 19-year-old Nick Kyrgios, who came back from two sets down and saved a match point in a 5-7, 4-6, 6-3, 7-6 (5), 8-6 win over Andreas Seppi.

Kyrgios, a Wimbledon quarterfinalist last year, is the first Aussie male to reach the last eight at the Australian Open since Lleyton Hewitt in 2005, and the first male teenager since Roger Federer in 2001 to reach two Grand Slam quarterfinals.