A pulled muscle in Paris a fortnight ago saw Milos Raonic hand Andy Murray the walkover which allowed him to rise to the summit of the world rankings for the first time. So perhaps it was appropriate yesterday that the Canadian forced the Scot to strain every sinew and travel to the ends of the earth just to stay there.

Played out over a stamina-sapping three hours and 38 minutes, this 5-7, 7-6 (5), 7-6 (9) win was the longest three-set match in the history of the ATP World Tour Finals, outstripping the three hours 20 mins of Murray's round robin match against Kei Nishikori earlier this week. It was also the longest three-set match of the Scot's entire career. The London marathon usually commences in Greenwich but not at this time of year on an indoor tennis court.

While he still must face Novak Djokovic for the first time since this year's French Open final and dare the Serb to personally remove that number one ranking - the showpiece final the sport has been craving - his historic rival would quite happily have taken it back last night if he hadn't got over the finishing line here.

While the 29-year-old from Dunblane looked to be running on empty and appeared to have hit the wall at times during his 86th match of 2016 - more than any season in his career so far - he still got the second wind he required to keep him as World No 1 this morning and keep his pursuit of a maiden ATP World Tour Finals win on track. At his eighth attempt, this is his first time he has ever reached the final of this competition.

History must have cautioned this Canadian about the difficulties of overcoming the Scot on his adopted terrain of London. The naturalised Montenegrin with the monster serve had fallen short twice previously in high-profile encounters against Murray within earshot of the Bow Bells this year, first bossing a Queen's Club final until that match turned on its head, then doing his best to give the Scot palpitations as he won his second Wimbledon crown. He has never been closer to victory than he was yesterday, though, against a Scot at his braveheart best who had to battle against his own body as well as an inspired opponent.

Having battled his way back from the loss of the first set, this usually so sure-footed Scot was unable to serve for the match twice. After his first failure, the second of four back-to-back games which went against the serve, he hit the ball high into the rafters, bouncing off into the crowd. "Obviously if you hit balls into crowds, stuff like that, obviously you're close to getting defaulted" said Murray. "But that's happened to my opponents this week, as well, and they didn't get warnings for hitting a ball up into the scoreboard. It was easier to re-focus because of where you were in the match, the finish line's literally right there."

The final set tie-break was even more fraught - the 29-year-old seeing three of his own match points come and go, and one for Raonic, by the time he finally ended the torture, for the watching fans and most importantly him. It was high drama all right, the World No 1 shunted onto BBC1, supplanting Final Score and leading the network's early evening programming neatly onto Strictly Come Dancing.

"I think for drama and stuff at the end of the match, it was pretty dramatic," he said. "Both of us had chances. I think we played some pretty good stuff in the tie-break. I don't think it was bad points that we were losing or bad shots we were playing."

Whether he enjoyed it all or not was another matter. "It's not that easy to enjoy matches whilst you're actually playing them," he said. "Obviously you get the enjoyment and the highs from winning, and obviously some losses are tougher than others. Had I lost tonight's match, I would have been pretty down."

Raonic - who may face Murray on Davis Cup duty in Ottawa in February - said he had never "competed better" and particularly appears to have improved on his return game. One of the more bizarre statistics in this one was that Murray during the first set was winning significantly more points on his second serve than his first. The Scot had lost all his challenges, had to fend off four break points, and endure a time violation warning before he got in at 4-4, but two more break points came along in the 11th game and Raonic saw things through 7-5.

Murray knew there and then that he was going to have to do things the hard way but he can't have imagined it would be quite so hard. Having hauled himself back into it from a break down, his left hamstring appeared to be giving way during the second set breaker and he again found himself out of challenges, but at least his first serve was back. A crucial mini break came his way for 6-5 and when a Raonic return flew long we were into a decider.

By now, the crowd was as riotous as a West Ham home match at the nearby Olympic Stadium. Everything was a distraction, including the Spider Cam, flash photography and fans squealing during points. It was a relief to everyone, not just the players, when one last forehand from the Canadian struck the net.