MELBOURNE, Australia (AP)Rafael Nadal is within one victory of a men’s record 21st Grand Slam singles title.

He’ll have to beat second-seedeed Daniil Medvedev in the Australian Open final on Sunday to make history. And Medvedev is chasing a piece of history of his own after beating Stefanos Tsitispas 7-6 (5), 4-6, 6-4, 6-1 in a heated semifinal on Friday. The U.S. Open champion is aiming to be the first man in the Open era to win his second Grand Slam title at the next major tournament.

Nadal advanced to the final in Australia for the sixth time with a 6-3, 6-2, 3-6, 6-3 win in a mostly lopsided contest against seventh-seeded Matteo Berrettini in the first of the men’s semifinals.

Medvedev had a more tempestuous and challenging run to back-to-back Australian Open finals. He had to deal with a hostile crowd in his second-round win over Nick Kyrgios, had to save a match point and rally from two sets down to beat Felix Auger-Aliassime in a nearly five-hour quarterfinal win. Then he had to regain his composure after an angry outburst in the second set of the semifinals.

The Russian yelled at chair umpire Jaume Campistol in the changever after serving a double-fault to concede a late break, getting a code violation for a visible obscenity when he made a gesture with his arm to the pro-Tsitsipas crowd, and then demanded that his opponent be cautioned for receiving coaching from his father – in Greek – from the stands.

Medvedev returned after Tsitsipas converted his third set point to level the match and he again urged the umpire to give the French Open runner-up a code violation.

He then took a five-minute break, took control late in the third set and then reeled off the last five games after Tsitsipas was eventually cautioned for coaching.

Nadal’s run to a 29th Grand Slam final has been comparatively serene.

After the last point, he stopped, beamed a wide grin and then punched the air three times.

Nadal arrived in Australia not knowing how long he would last after months off the tour dealing with a serious foot injury and then a bout of COVID-19. He skipped Wimbledon after losing in the French Open semifinals to Novak Djokovic, and didn’t play at all after August.

”Every day has been an issue in terms of problems on the foot. Doubts still here … probably for the rest of my career,” Nadal said. ”But for me it’s amazing … (to) just compete and play tennis at the high level again, facing the most important players of the world.”

Last month, he wasn’t even sure he’d be able to return to the tour. But he won a tune-up tournament in Melbourne and has taken six straight matches at the first Grand Slam event of the year.

One more and he’ll break the record of 20 major championships he shares with Roger Federer and Novak Djokovic. Nadal would also become just the fourth man to win all four Grand Slam titles at least twice.

Nadal’s win over Wimbledon runner-up Berrettini, under a closed roof at Rod Laver Arena, because of heavy rain, was his 500th on hard courts at tour level.

But he’s only won the Australian Open once, in 2009, and adding a second was his primary focus.

”For me, it’s all about the Australian Open more than anything else,” Nadal said in his on-court interview. ”I have been a little unlucky (here) in my career with some injuries. I played some amazing finals with good chances.”

He lost classic five-set finals at Melbourne Park to Djokovic in 2012 and Federer in ’17. Nadal lost to Stan Wawrinka in 2014 and against Djokovic three years ago.

”I feel very lucky that I won once,” he said. ”I never thought about another chance in 2022.”

Nadal broke Berrettini’s opening service games in the first two sets and, after dropping the third set on a rare service lapse, he rallied to finish off the match in just under three hours. That in itself was a relief after his long quarterfinal win over Denis Shapovalov.

Nadal was the only member of the so-called Big Three who had a chance to break the deadlock in Australia this time.

Federer is out while recovering from knee surgery. Djokovic, who has won nine of his Grand Slam titles at Melbourne Park, was deported after an 11-day visa saga on the eve of the tournament because he failed to meet Australia’s strict COVID-19 vaccination requirements.

”To be able to be where I am today, I really can’t explain in words how important is for me in terms of energy, in terms of personal satisfaction, in terms of being very thankful,” Nadal said. ”For me it’s something completely unexpected.”

He said he was taking a different approach to life now, but not at game time.

”Of course always with competitive spirit that I have, because I can’t go against that. It’s my personal DNA,” he said. ”But in some way, I don’t know, just be what I am and be able to have the chance to compete at this level, it’s a positive energy for me to keep going.”

Medevedev will need to take a calmer approach after beating Tsitsipas in the semifinals for the second year in a row at Melbourne Park. He lost to Djokovic in last year’s final, but then beat the No. 1-ranked player for the U.S. Open title.

He said he regretted his outbursts at the umpire, explaining it was in the heat of the moment in a very emotional tournament.

”I’m going to play again against one of the greatest,” Medvedev said of Sunday’s final. ”Again, I’m going to play somebody going for the 21st Slam. I’m ready.”

More AP tennis: https://apnews.com/hub/tennis and https://twitter.com/AP-Sports