It was no cakewalk for the world No. 1, who was on court for three hours, 15 minutes, by far his longest match of the tournament so far.
In a contest packed with gruelling baseline rallies, the No. 15 seed showed regularly that he was more than a match for Djokovic.
But the six-time Melbourne champion eventually prevailed, winning key points at crucial moments and taking advantage of his opponent's fatigue as the match went on.
Medvedev looked up for the challenge from the off, valiantly breaking at 5-3 behind to get himself back in the opening set.
The Russian could not consolidate as he served to stay in the set, double-faulting to concede a set point, which Djokovic duly took with a backhand pass. But it had not been easy, and it only got tougher.
Medvedev saved five break points in his opening service game of the second set, one at the end of a 31-shot rally, and he matched Djokovic blow for blow.
The Serb then broke for a 3-1 lead after a 40-shot rally, and Medvedev broke back for 4-3 after another monster exchange.
Encouragingly for the 22-year-old, Djokovic was the one who looked to be suffering most from the relentless rallying.
Never did that show more than in the second-set tiebreak, which Medvedev won despite losing the first three of his four set points:
Djokovic has made a habit in his career of bouncing back when he has looked to be suffering, and he did just that.
At 2-1 down in the third set, Djokovic conceded three break points, and it looked as though the match could be turning in Medvedev's favour.
As it was, though, the 31-year-old produced some of his vintage best, showing his incredible athleticism and shot-making to save all three and hold for 2-2.
He then took the next four games in a row to take the third set as Medvedev started to struggle physically.
When Djokovic broke for a 2-1 lead in the fourth set, the youngster's challenge looked to be over for good.
However, the 14-time Grand Slam winner laboured to the finish line rather than blowing Medvedev away in the fourth, with his first serve effectively deserting him down the homestretch.
But he did enough to set up a last-eight clash with Kei Nishikori.