After Murray took the first set with a collected display, Djokovic fought back to parity and took what initially seemed to be a deciding break in the third set as Murray started to flag.
But the world number three broke back late on to set up a grandstand finish, which saw Djokovic break once more before saving a break-back point at 6-5, holding on to claim victory in two hours and 34 minutes, taking his record against Murray to 10-7.
The Serb's place in the semi-finals is still not certain after Jo-Wilfried Tsonga fell to defeat to Tomas Berdych in the evening match in Group A, and all four players, even winless Tsonga, could still qualify.
Djokovic, who has two wins from two matches, faces Berdych on Friday when victory would guarantee top spot in the group. Murray, who like Berdych has one win, plays Tsonga knowing a straight-sets victory would clinch a semi-final spot.
"Another great match. Another great performance from both of us," Djokovic said afterwards. "I didn't expect anything less, other than a tough match that went down the wire and was decided in the last point.
"We have a great rivalry that hopefully will develop even more in the future."
"The last two minutes of the match were about what decided it," Murray admitted. "He broke at 15-40 and then I had 15-40 in the next game and didn't break."
Murray was clinical and classy in the opening set, breaking at the first time of asking as his aggressive, attacking rushes were backed up with some crisp passes.
He tossed in some aces too as Djokovic failed to muster a break point, while Murray almost broke him for a second time at 5-3, following that with a love hold to close out the set.
And he almost broke Djokovic early in the second as the world number one got his angles wrong from deep on a couple of occasions – two accurate winners saw to that, however, and the Serb held for 2-1.
You cannot let your guard down with Djokovic, and a sloppy service game from Murray midway through the second set saw the Serb break as a poor volley dropped long, a second error of game that featured more mistakes from the Briton than his entire first set.
Djokovic capably guarded that break to force a decider, which Murray started cleanly enough with an ace to build a hold to love.
It was an even battle, a war of attrition typical to these men as they exchanged baseline bullets and goaded each other to the net to close the points.
But another sloppy service game from Murray handed Djokovic a break at 2-1 as the Scot showed a worrying tendency to bunch his errors into consecutive points, repeatedly striking long as he lost his range from the baseline.
Djokovic defended his break with some fine winners off the lines, while Murray continued to make unforced errors although did manage to scramble a hold on his next service game after saving two break points in an epic duel.
He needed to break back though and Djokovic barely gave him a sniff as he served crisply and constructed his points with Murray-like guile. Meanwhile, his opponent was finding the net under no pressure as he scrapped to another testing hold off break point.
But, with Djokovic serving to take a 5-3 lead, Murray seemed to flick a switch in concentration, matching the Serb’s deliveries with his speed-killing returns, and correctly challenging on two occasions, the second yielding a vital break as Djokovic had gone wide.
From that position of authority Djokovic was suddenly serving to stay in the match, which he did under some pressure as Murray sensed victory.
Despite the apparent swing in momentum, Murray was ultimately the architect of his own downfall as he allowed a rogue shout from the crowd to distract him while serving at 5-5, netting his subsequent follow-up and broken after sending a drive long from deep.
It was not close to being over though as, with Djokovic serving for the match, Murray earning two break-back points as he hustled the Serb from the baseline.
But Djokovic found another gear, some fine serving setting up match point, which was taken somewhat inauspiciously as Murray send an errant drive long.
1-Novak Djokovic (Serbia) beat 3-Andy Murray (Britain) 4-6 6-3 7-5
5-Tomas Berdych (Czech Republic) beat 7-Jo-Wilfried Tsonga (France) 7-5 3-6 6-1
- Sports & Recreation