New York (CNN) In this last grand slam of 2019, a 19-year-old won the women's title at the US Open, and Rafael Nadal landed his 19th major Sunday in dramatic fashion to creep up on Roger Federer on the grand slam ladder.

A day after Bianca Andreescu defeated Serena Williams to win her first -- and Canada's first -- singles grand slam, Nadal survived against debut grand slam finalist Daniil Medvedev of Russia 7-5, 6-3, 5-7, 4-6, 6-4 in a bruising, four-hour, 50-minute thriller in New York.

The two matchups just happened to be the finals of the Rogers Cup a few weeks ago, with Andreescu and Nadal winning those, too.

"It's been one of the most emotional nights of my tennis career," said Nadal, who wept in his chair when a recap of his 19 majors was shown on the big screen at Arthur Ashe Stadium. He later took the time to send his condolences to former tour player Karim Alami, whose son died recently.

Medvedev certainly fared better than when he met Nadal in Montreal, claiming a mere three games.

Despite the tough loss, he showed a sense of humor during his speech.

"If I win, what will they show?" he said, referencing Nadal's video tribute.

He won over the fans Sunday, during a fortnight where he was previously cast as a villain.

The final wasn't without controversy but it had nothing to do with Medvedev, as Nadal was docked first serves twice by chair umpire Ali Nili in the fifth set for taking too long to serve.

The mostly pro-Nadal crowd of 24,000 seemed to disapprove and Nili was booed during the trophy presentation. Nadal making Medvedev wait throughout while the 23-year-old served is sure to be debated, too.

In truth, though, it came nowhere close to the controversy in last year's women's final when Williams clashed with chair umpire Carlos Ramos.

Nadal was creaking entering the fifth set, but in one of the two key games of the fifth, saved three break chances at 0-1. One came after he was docked a first serve.

Medvedev was then broken from 40-0 at 2-2 in the other massive game.

Medvedev comeback

He refused to buckle, however, getting from 2-5 to 4-5 after saving a pair of match points. Medvedev even held a break chance in the last game, though Nadal ended by claiming the last three points.

It meant Nadal has still only lost one grand slam match when leading by two sets -- at the US Open in 2015 versus Fabio Fognini.

While Medvedev and Andreescu's careers are in their infancy, the 33-year-old Nadal has been going for years.

But given all the injuries he has suffered, questions were raised about whether the Spaniard would be able to compete for this long.

He's answered those.

Another more recent question has been: Will Nadal catch Federer in the grand slam stakes?

That is looking increasingly likely, as he trails the Swiss now by only one.

At 38, who knows how many more grand slam titles Federer will amass. Nadal, meanwhile, even if he doesn't win the Australian Open in January, looks certain to bag at least one more French Open title. He is after all the undisputed king of Roland Garros, with a mind boggling 12 crowns.

Nadal repeated that he isn't obsessed with finishing with the most majors but added: "If that attracts fans and creates interest on the people, that's good for our sport, no?

"I feel honored to be part of this battle."

On the hard courts of New York, Nili drew the ire of Nadal when he gave him a time violation warning while serving in the very first game.

A slightly rattled Nadal dropped serve in his next service game and conversed with Nili at the change of ends, showing his displeasure.

Nadal immediately broke back against the fifth seed and held serve comfortably while pressuring the Medvedev serve.

Rafael Nadal dropped to the court after winning the US Open Sunday.

He got his reward at 6-5, converting on his second set point with a wonderful lob that forced an error. Nadal was 15-1 in grand slam finals when he won the first set, and that trend held, barely.

The lanky, 6-foot-6 Medvedev is a gifted counterpuncher with a massive serve, when it's on. And he can change his style and attack when required. There is a plan B and even C.

Change of tactics

He indeed tweaked his tactics in the second set, standing closer to the baseline and trying a drop shot or two.

Some worked, some didn't. But the intent proved he was thinking.

Overall he hit 75 winners and 57 unforced errors, to Nadal's 62 and 46. He was also virtually even against gladiator Nadal in rallies that were nine shots or longer, 33-36.

And let no one say this was a dull baseline duel. The players combined to win 101 net points and served and volleyed 49 times.

Nadal fended off a break chance to start the second and broke to lead to 4-2.

Daniil Medvedev lost the US Open final but not without a fight.

Medvedev's hopes of becoming the first, first-time men's major winner since Marin Cilic at the 2014 US Open were fading fast.

They seemed to evaporate when broken at 2-2 in the third, and Medvedev admitted he was already thinking of what he'd say in his runner-up speech. But the Moscow native responded, thanks in part to a rare Nadal miss at the net at deuce in the ensuing game.

"I played a not very good game at 3-2," said Nadal. "In that moment things looked under control, but then Daniil increased a lot and changed a lot of things."

Medvedev hung in there, overcoming losing a 28-shot rally and saving two break points for 5-4. The fans appreciated his gutsy display.

Some even started to chant, "Med-ve-dev, Med-ve-dev." Bolstered, Medvedev blasted his way to the set.

"The atmosphere was the best of my life," said Medvedev.

Nadal was up against it as afternoon turned to evening, so much so that he faced a break point at 0-1 in the fourth. The fans got the extra tennis they were looking for, but now sensing Nadal was in trouble, the chants of "Rafa, Rafa" began.

Medvedev wouldn't be denied, though, as the pendulum swung. Nadal was broken from 40-15 to end the set, Medvedev ripping a return winner to force a wild fifth.

Deep trouble

Nadal was in deep trouble now and even more so facing the three break points at 0-1 in the fifth. He stepped up his game as he has done so often before, even when deprived a first serve on the final one due to his slow play.

"At the beginning of the fifth, I cannot lose my serve," said Nadal. "If I am able to hold my serve, I really thought -- I really hoped -- that I going to have my chances."

They came in that fifth game that Medvedev seemed to have under control.

It was a crushing game to lose and Medvedev dropped serve from 30-0 to give Nadal what would prove to be a pivotal insurance break for 5-2.

Nadal was broken -- on a double fault -- after another first serve was taken away and Medvedev saved two match points to get to 4-5 as the breathtaking rallies continued, one with a rocket backhand down the line.

Daniil Medvedev asks for the fans to give him more applause during the trophy presentation Sunday at the US Open.

But the comeback stopped there as Nadal fended off one last break point, sealing the epic when a return sailed long. He collapsed to the court in joy.

On paper, Nadal has endured tougher paths to grand slam glory -- Medvedev was the first top-20 player he encountered during the fortnight and he didn't have to deal with the injured pair of Federer and top-ranked Novak Djokovic -- but as the saying goes, you can only beat who is in front of you.

There is surely more to come from Medvedev, who joined Andre Agassi and Ivan Lendl as the lone men's players in the Open Era to reach finals in Washington, Canada, Cincinnati and the US Open in the same season.

"It was an amazing match," said Medvedev. "It's an amazing story. All this summer is amazing for me. I will remember every moment of it. I have a really good memory if we talk about tennis. I'll definitely remember it even when I'm, like, 70 years old."

The confidence of reaching a first grand slam final -- the first of the men's "Next Gen" to do so -- when he'd never previously gotten past the fourth round will linger. Medvedev battled his way to the final after dealing with cramps, shoulder, abductor and quadriceps issues, not to mention battling the raucous crowd at Flushing Meadows.

Crowd interaction

His middle-finger salute to them, trolling them in an interview and dancing his way to the net following a fourth-round win won't be forgotten. But they were somewhat in the rearview mirror by the time Sunday rolled around and he received healthy applause during the trophy ceremony.

"You were booing me for a reason, but you guys also see that I can change because I'm a human being," he said, to cheers.

Nadal showed his super-human abilities once again on a tennis court.