Novak Djokovic became the oldest man to win the US Open at the age of 36 years and three months
The 36-year-old Serb won 6-3 7-6 (7-5) 6-3 but the straight-set scoreline does not tell how deep he had to dig.
A comfortable opening set was followed by a brutal second which lasted one hour and 44 minutes.
After the pair exchanged breaks early in the third, Djokovic took control to level Margaret Court's 50-year record.
"It obviously means the world to me," said Djokovic on winning his 24th major.
"I'm really living my childhood dream to compete at the highest level in this sport, which has given me and my family so much from difficult circumstances.
"I never thought I would be here but the last couple of years I thought I had a shot at history. Why not grab it when it is presented?"
Second seed Djokovic looked physically troubled in that gruelling second set, but showed all the hallmarks of his greatness to win a fourth US Open title.
Djokovic, who surpassed Rafael Nadal's record tally of 22 men's major titles earlier this year, has matched Australia's Court at the second attempt after losing the Wimbledon final in July.
He has won three of the four Grand Slam titles in 2023, becoming the first man to achieve this feat on four occasions.
Now the incoming world number one has the chance to surpass Court at January's Australian Open - where he has already won a record 10 titles.
It felt fitting that Djokovic set up championship point by winning another lengthy rally and, after being made to wait to serve by shouts from the crowd, sealed victory when Medvedev hit a forehand into the net.
"I would definitely sign right away the paper if somebody would tell me I would win three out of four and play Wimbledon finals this year," Djokovic said.
"There is a little regret that I didn't win that Wimbledon final. But, at the end of the day, I have so much more to be happier and content with than actually to regret something."
-- Courtesy of BBC Sport