Rafael Nadal overcame Daniil Medvedev in five breathtaking sets to claim his 19th Grand Slam title at the US Open.

The Spanish second seed led by two sets and a break, but he needed to halt a thrilling comeback from Russian rebel Medvedev to win an epic showdown 7-5, 6-3, 5-7, 4-6, 6-4.

Hot-headed Medvedev was playing in his first Grand Slam final, having revelled in his new role as public enemy number one of the New York crowd.

The 23-year-old had been jeered by those in the stands throughout the fortnight after he flipped them the middle finger during the third round.

Yet, when he launched an unlikely counter-attack in the third set, it was like Rocky in reverse, the fans around a packed Arthur Ashe suddenly chanting his name.

However, Nadal dug as deep as he has probably ever had to to secure a dramatic victory in four hours and 50 minutes to move to within one major title of Roger Federer’s record tally of 20.

Nadal, whose hackles were raised when he was given a time violation at break point down in the very first game, took the opening set with a break at 6-5 thanks to a whipped forehand winner and a lob which Medvedev dumped into the net.

The Russian saved four break points in his next two service games, but the jabs kept on landing, Nadal breaking through again for 4-2 and taking a two-set lead.

Fatigue seemed to be setting in for Medvedev, who was being pushed all around the court, and when a backhand hit the net at break point in the fifth game of the third set, he looked beaten.

But he kept swinging, somehow breaking back to level, and with the crowd now firmly behind their new darling, he repeated the dose at 6-5 to take it to a fourth set with Nadal now the man looking vulnerable.

Gutsy hold after gutsy hold followed until Nadal sent a forehand wide and Medvedev had a break point, which he dispatched with a stunning return to force a decider.

It was sensational stuff, but the odds were still stacked against Medvedev. He had never before won a five-set match and Nadal had lost only twice from two sets up in his career.

Nadal’s delaying tactics were irking the Russian, but he fashioned two break points, then a third, only for Nadal to escape again.

When Nadal eked out a break point of his own at 2-2, Medvedev aced him, but when Nadal created another, a double-handed backhand putting him back in control.

Still the drama continued.

Nadal broke again, but, serving for the match, he was given a second time violation by umpire Ali Nili and docked a serve at break point down, and promptly sent his second serve wide. Umpiring controversy is not confined to Serena Williams here, it seems.

Medvedev saved two match points on serve, but when Nadal had the ball in his hand again he finally got over the line, a long Medvedev return bringing to an end a truly remarkable final.