Djokovic, No. 2 in the world, and Murray, ranked third, battled for 3 hours, 21 minutes before Djokovic finished off a 5-7, 7-6 (13-11), 6-3 victory. Murray had been seeking a third consecutive win at the Shanghai Masters.
Djokovic, who won in Shanghai in 2008, is 13-10 in Masters tournament finals, including 3-3 this year. It was his 52nd ATP title overall and fifth in 2012.
Murray put up a spirited defense, breaking Djokovic's serve four times in the seesaw first set. The set turned on the 11th game when Djokovic was up 40-0 but was broken on the eighth point.
Murray took the edge in the second set with a break in the seventh game but Djokovic pulled even at 5-5, fighting off Murray's first championship point in the process. Murray had four chances to end the match in the tiebreaker but Djokovic was able to take the set with a volley in the tiebreaker's 24th point.
Djokovic took the lead with a break for a 4-3 lead in the third set and won his next service game with a final-point ace. He finished the match with his sixth break of the day.
Djokovic is now 9-7 all-time versus Murray but the last two meetings have been very tight. Murray defeated Djokovic in a 4-hour, 54-minute, five-set match in the finals of the U.S. Open in their most recent meeting.
2014: The Year in Music [PHOTOS]