The world number one had worked hard to establish a 3-2 lead in a mesmerising start to the Tokyo Group clash, but 24-year-old Medvedev then found another gear to seize control.
Pummelling high-velocity groundstrokes deep into the corners, Medvedev went on a near-perfect seven-game winning sequence to leave a bemused Djokovic puffing out his cheeks.
By the time five-time champion Djokovic managed to stop the rot the 33-year-old was a set and 3-1 in arrears.
Medvedev was relentless, however, and continued to boss the baseline rallies as he moved into a 5-2 lead.
Djokovic held serve to at least test Medvedev’s nerve, but the Russian was ice cool as he closed out victory to make it two wins from two in the group and guarantee a semi-final berth.
Medvedev, who made only 12 unforced errors, lost all three of his group matches on his debut here in London last year, but now looks like a genuine title contender.
Djokovic, on the other hand, faces a straight shoot-out with Alexander Zverev on Friday (November 20) as he tries to keep alive his hopes of progressing from the group and staying on course for a record-equalling sixth title at the tournament.
Earlier at the O2 Arena, Zverev bounced back from his defeat by Medvedev to beat Diego Schwartzman 6-3 4-6 6-3.