The 2019 runner-up saved four break points in the first set tie-break, which was briefly delayed by an electrical fault, and his 7-6 (8) 6-3 7-6 (5) win did not come without fitness concerns.
Medvedev required treatment on a shoulder injury and cramp midway through the third set and admitted afterwards that the match might have taken a turn for the worse had he not polished off the second tie-break.
Medvedev, who let out a roar upon completing his win, said: "It was tough and that was why maybe for the first time in almost a year I celebrated my win.
"I felt like I could get in trouble so I was really happy to get the win in the tie-breaker. One point decided two sets so it was a tough match and Andrey was playing unbelievable."
The first set between two lifelong friends swung with serve before Rublev let slip a golden opportunity to become the first man to take a set off Medvedev in the tournament, letting slip a 5-1 lead in the tie-break.
He let his frustration get the better of him as he rammed his racket into the court, and also received a code violation for an audible obscenity after Medvedev broke for the first time in the match to go 4-2 up in the second set.
Medvedev looked fully in command until midway through the third set when his movement became restricted, and his decision to call a medical time-out at 4-5 down in the set did not bode well for his hopes of claiming a maiden grand slam crown.
Under increasing pressure given his evident physical issues, Medvedev nevertheless managed to eke out another tight tie-break to take the match and book his place back in the last four.