After wasting three chances to serve it out then having to save three match points, Simona Halep finally fended off American Lauren Davis in a third-round win that took 3 hours, 44 minutes and equaled a record at the Australian Open.

For top-ranked Halep, already playing with an injured left ankle, the 4-6, 6-4, 15-13 victory Saturday was a testament to her renewed self-belief.

The third set took 2:22, and momentum swung, with 11 service breaks and two medical timeouts -- for Davis to get treatment for toes on both feet -- before Halep converted on her first match point.

Halep had chances to serve for the match in the ninth, 11th and 15th games of the third set but was broken each time by the No. 76-ranked Davis, who then blew three match points from 0-40 on Halep's serve in the 22nd game.

"Definitely was a very tough match, so long," said Halep, who has twice reached the final at the French Open but never won a Grand Slam singles title. "I never played the third set so long, so I'm really happy I could stay and win it. I'm almost dead."

It equaled the longest women's singles match at the Australian Open in terms of games played; Chanda Rubin's win over Arantxa Sanchez Vicario in 1996 was also 48 games. In terms of duration, it was almost an hour shorter than the record 4:44 that Francesca Schiavone needed to beat Svetlana Kuznetsova in 2011.

"I just feel that my muscles are gone," said Halep, who badly twisted her left ankle in the first round. "My ankle is, I don't know how it is because I don't feel it anymore! But ... it was nice to win this match."

Halep, who lost in the first round at the Australian Open in 2016 and 2017, said she was mentally stronger now.

"I was down love-40. She had three match balls. It was not easy, but I just kept playing. I just kept believing that it's not over," Halep said. "For sure I'm stronger mentally, and I could resist like for every moment in the match. That makes me very happy, and I think the big win is that I could handle it."

Davis lost the three previous times she had played in the third round of a major, but she did everything possible to stay in the match, keeping long rallies alive to put pressure on Halep.

The 24-year-old American finished with roughly twice the number of winners (52 to 27) against slightly less than double the unforced errors (73 to 39) and broke Halep's serve six times.

"We were both fighting our hearts out. Every point was super long," Davis said. "I got to the point where I was so tired, I just told myself to swing and move. I didn't feel any pressure."

Halep will next play Naomi Osaka, who beat local hope Ashleigh Barty 6-4, 6-2. The Japanese 20-year-old's win finally marked some success in the third round at a major. She was previously 0-for-5.

In what was expected to be the match of the round, Angelique Kerber ensured it never became a contest.

The 2016 Australian Open winner routed Maria Sharapova 6-1, 6-3, meaning Kerber will be the only Grand Slam champion in the fourth round of the women's draw.

Five-time major winner Sharapova was back at Melbourne Park for the first time since 2016, when a failed doping test led to a 15-month ban from tennis.

Sharapova advanced while seeded players fell in upsets in the first two rounds and was growing in confidence but had no answers for Kerber, who is on a 12-match winning streak in a kind of comeback of her own after sliding down the rankings last year.

"I learned a lot from the last 12, 24 months. I had a great 2016, and last year was a little tougher," Kerber said, reflecting on how her year-end ranking dropped from No. 1 to 21 when she failed to defend her Australian or US Open titles. "Anybody who knows me knows I never give up."

Sharapova said Kerber was the more aggressive player on court and took more risks.

"I gave her the confidence by making a lot of errors on the return games," Sharapova said. "She's a confident player at the moment.

"A lot of things I need to get better at and improve on. Looking at the overall picture -- the beginning of this year -- there's a lot to build from."

US Open finalist Madison Keys advanced 6-3, 6-4 over Ana Bogdan and will next play No. 8 Caroline Garcia, who beat Aliaksandra Sasnovich 6-3, 5-7, 6-2. Sixth-seeded Karolina Pliskova had 11 aces and beat No. 29 Lucie Safarova 7-6 (6), 7-5 in a match featuring just one service break.

The 17th-seeded Keys, who lost in the US Open final last year to Sloane Stephens, saved three break points serving for the match, finally clinching it on her first match point when Bogdan netted a backhand.

Keys missed last year's Australian Open after undergoing surgery to repair her injured left wrist. She then played only one match after the US Open before shutting down her season to let the wrist heal. It has helped her start the new season feeling mentally fresh as well.

"I finished the US Open, and I was exhausted," Keys said. "So as amazing as that run was, the combination of being exhausted from that and having a wrist that still wasn't 100 percent perfect, I just needed to kind of shut it down, calm down, and then I was really excited to start the new season."

Keys is the only one of the four American women who reached the semifinals at the US Open in September still in contention in Melbourne. Stephens, Venus Williams and CoCo Vandeweghe were all eliminated in the first round.

Hsieh Su-wei, who beat Wimbledon champion Garbine Muguruza in the second round, added another seeded player to her Australian Open victory collection with a 6-2, 7-5 win over No. 26 Agnieszka Radwanska.

On the final match of the night on Margaret Court Arena, Radwanska became upset with Hsieh's preoccupation with having moths removed from the court by ball boys and ball girls, suggesting to the chair umpire that they shouldn't bother because the insects were "everywhere" on the court.

Information from The Associated Press was used in this report.