MELBOURNE—Madison Keys, who will face Ana Ivanovic in the third round of the Australian Open, said that she made sure to dig deep in the first two rounds.

And she knows she will likely have to do that again against the former world No. 1.

The No. 17th-ranked Keys bested Zarina Diyas in the first round in straight sets—coming from a break down in the first—and then needed three sets to defeat Yaroslava Shvedova in the second round.

“I definitely have been working a lot on the mental side of my game,” the 20-year-old Keys said. “Being able to stay a little bit more composed through whatever is going [on] on the court, just figure some stuff out when I'm not playing perfect tennis.”

Keys reached the semifinals of the 2015 Australian Open, and was knocked out by world No. 1 Serena Williams. She hired a new coach, Jesse Levine, at the end of last year.

The American also reached the quarterfinals of Wimbledon, but didn’t make it past the fourth round at the French Open and U.S. Open.

“The biggest thing is just kind of changing my perspective on a lot of stuff,” Keys said. “Instead of it being a daunting thing, being down a set, just [take] it as a challenge, [know] that I've worked really hard for all of the off-season and I'm ready to be in the position. Go out there and be super positive about it.”