The 33-year-old Spanish left-hander moved one shy of Roger Federer's all-time men's record 20 Grand Slam triumphs and became the second-oldest New York champion in the Open era after Ken Rosewall in 1970 at age 35.
“Has been one of the most emotional nights in my tennis career,” Nadal said.
A video tribute in the wake of his gritty triumph moved Nadal to tears.
“The way that the match became very dramatic at the end, that makes this day unforgettable,” Nadal said.
“Watching all the success, all the moments that came to my mind, I tried to hold the emotion, but some moments was impossible.”
It took a supreme effort from the Spanish maestro, who nearly became the first player to drop the final after leading by two sets since Ted Schroeder in 1949 before winning a near five-hour thriller.
“This victory means a lot,” Nadal said. “And the way it happened. It was hard to control the nerves. The nerves were so high after having the match almost under control.”
World number two Nadal took the top prize of $3.85 million at Arthur Ashe Stadium and added to his US Open trophy haul from 2010, 2013 and 2017.
Nadal, who was in his fifth US Open championship match and 27th Grand Slam final, is the first man to claim five major titles after turning 30.
Nadal, who rose to 22-12 in five-set matches, only lost once at a Slam when up two sets, to Italy's Fabio Fognini in the 2015 US Open third round.
“I more or less had the match under control,” Nadal said. “The way he was able to fight, to change the rhythm of the match, was incredible.”
– Unbelievable, outrageous' –
At four hours and 50 minutes, the match finished four minutes short of equaling the longest final in US Open history from Mats Wilander's 1988 win and Andy Murray's 2012 title.
It was the second Slam title of the year for Nadal after taking his 12th French Open crown in June.
In addition to reaching the brink of Federer's mark, Nadal moved one shy of the Open era record five US Open titles won by Federer, Jimmy Connors and Pete Sampras.
“A 19th Grand Slam title is something unbelievable, outrageous,” Medvedev said.
Nadal, who won his only prior meeting with Medvedev in last month's Montreal final, stretched his win streak over Russians to 20 matches since losing to Nikolay Davydenko in the 2011 Doha semi-finals.
Fifth seed Medvedev, 23, would have been the youngest men's Grand Slam champion since Juan Martin del Potro at the 2009 US Open.
Medvedev, who will rise to a career-best fourth in the rankings, was a champion at Cincinnati and runner-up at Montreal, Washington and the Open.
“His summer was one of the best summers I ever saw,” Nadal said. “People saw why he is already number four in the world.”
Medvedev, who saw his career-best 12-match win streak snapped, would have been the first Russian to win a Grand Slam title since Marat Safin at the 2005 Australian Open and the first Russian to win the US Open since Safin in 2000.
– Electric fifth set –
On a knife's edge at 5-5 in the third set, Medvedev reeled off eight of the last nine points to force a fourth, breaking Nadal in the 12th game with a backhand winner.
“To be honest in my mind, I was already thinking, 'What do I say in the speech, it's going to be in 20 minutes,” Medvedev said.
“I was like, 'I have to fight for every ball,' and it went further but it didn't go my way.”
Nadal was broken in the 10th game of the fourth set to force a fifth when Medvedev blasted a sterling backhand return winner.
Nadal rescued three Medvedev break chances to hold in the second game of the fifth set, fired a backhand volley winner to break Medvedev in the fifth game and seized a 5-2 edge when Medvedev hit an overhead smash long.
Serving for the match, Nadal was broken when umpire Ali Nili issued Nadal a time violation for his first serve and the Spaniard sent his second long, the crowd booing Nili for his call.
Nadal squandered two break and match points in the ninth game as the drama intensified.
Again serving for the match, Nadal rescued a break point then hit a forehand drop volley for his third match point chance and Medvedev sent a forehand return long to end matters.
Nadal screamed and fell to the court on his back in joy and exhaustion.