Novak Djokovic came back from the brink to deny Andy Murray a hat-trick of Shanghai Masters titles in a bad-tempered final.
World number two Djokovic saved five match points during the second set before pulling through 5-7 7-6 (13/11) 6-3 to claim his second tournament win in as many weeks and a measure of revenge for his US Open final defeat in the pair's previous meeting.
The Serb demolished his racket after surrendering his serve for the fourth time in the opening set, a break that handed Murray a 6-5 lead.
World number three Murray, who had been broken three times himself to that point, duly served out the opener without alarm and took the initiative with another break for a 4-3 lead in the second set.
The Scot served for the title at 5-4 but Djokovic escaped from championship point down to break back and then saved four more in the subsequent tie-break.
After Djokovic prevailed 13-11 in a 20-minute plus breaker it was Murray's turn to take out his frustration on his equipment.
Djokovic broke through for a 4-3 lead in the decider and again to seal the title against his deflated opponent.
Murray's defeat dashed hopes of a British double on Sunday after Heather Watson had earlier become the country's first WTA Tour champion since 1988 at the Japan Open.