MONTREAL (AP) Andy Murray beat top-ranked Novak Djokovic 6-4, 4-6, 6-3 on Sunday in the Rogers Cup for his fourth tournament victory of the year and third title in the Canadian event.

The second-seeded Murray also won the tournament in 2009 and 2010. The Scot ended an eight-match losing streak against Djokovic since the 2013 Wimbledon final.

Murray dedicated the victory to his coach, Amelie Mauresmo, the former women's star who gave birth to a boy Saturday.

''I don't know much detail,'' said Murray, whose wife, Kim, is due to give birth to their first child in February. ''I haven't spoken to her. I'd imagine she's quite tired. Probably me and my tennis are the last thing on her mind just now, which is totally understandable.''

Djokovic, the champion in 2007, 2011 and 2012, lost for only the fourth time in 56 matches this year. The Serb failed in his bid to tie the ATP Tour record for consecutive Masters 1000 event titles at five.

Djokovic was playing his ninth straight final, a run that included championship victories over Murray this year in the Australian Open and Key Biscayne, Florida.

Djokovic said pain in his right elbow limited his ability to serve.

''Not taking anything away from him, from his victory,'' Djokovic said. ''He deserved it.

''He stepped in, played some great shots. Most of all the moments when he needed to, he served very, very well. That one game when I had I think four, five opportunities to break back, he just came up always with big serves, so I couldn't do much. But it was a great week all in all for me.''

Murray cut Djokovic's series lead to 19-9.

In hot, muggy conditions at Uniprix Stadium, Murray served at 3-1 in the third, already up a break.. A ferocious baseline battle went to deuce 10 times and Murray fought off six break points to take the game.

Djokovic had two more break points in the final game, but Murray pounded two service winners and eventually won when Djokovic hit a groundstroke long after a brief rally.

Murray will move to No. 2, ahead of Roger Federer, in the new world ranking Monday.

In the doubles final, American twin brothers Bob and Mike Bryan beat Daniel Nestor of Canada and Edouard Roger-Vasselin of France 4-6, 6-3 10-6.