By Martyn Herman

LONDON (Reuters) - Andy Murray and Novak Djokovic, the dominant forces of men's tennis, will collide head-on in a fitting climax to the season at the ATP World Tour Finals on Sunday after taking vastly different paths to the title match.

Murray, who should trademark the 'tennis epic', spent three hours 38 minutes -- a tournament record -- quelling the ferocious firepower of Milos Raonic, dragging himself to a 5-7 7-6 (5) 7-6 (9) victory in a fever-pitch atmosphere at the O2 Arena.

The Scot, aiming to win a maiden Tour Finals crown and clinch the year-end world number one ranking for the first time, had barely finished his post-match news conference before Djokovic completed a 6-1 6-1 rout of Japanese Kei Nishikori.

Murray, who plunged into an ice bath after surviving his grueling battle, including saving a match point, also spent three hours 20 minutes beating Nishikori on Wednesday.

Only he knows what is left in the tank for Sunday but he is protecting a three-month unbeaten run, a streak that helped eclipse Djokovic at the top of the rankings and now stands at a career best 23 wins, with fanatical zeal.

Djokovic will be the fresher man and, after a relatively lean second half of the year, would love to snatch back top-dog status with a fifth consecutive title in Murray's backyard.

For organizers of the flagship event it is the dream scenario. It is the first time the final match of the season will decide who is ranked number one.

"This has never happened," said the Serb who has beaten Murray in five of their seven grand slam finals including in Australia and France this year.

"I'm privileged to be part of history. This is one of the biggest matches we will ever play against each other."

Whatever lies in store it will struggle to surpass the adrenaline-fuelled drama provided by Murray and Raonic.

IMPOSSIBLE RIDDLE

The Scot was outplayed at times by the powerful 25-year-old Canadian who, apart from a two-game dip that cost him control of the match in the second set, was relentless.

Raonic led by a set and a break, twice broke serve to stay alive in a gripping decider, then saw a match point come and go in the tiebreak as he, like everyone recently, found Murray an impossible riddle to solve.

Murray looked out on his feet at times but scratched and clawed his way to a 77th win of a remarkable year on his fourth match point when Raonic netted at 10-9 in a tense tiebreak.

"It was pretty dramatic," the Scot said with a dose of under-statement. "It wasn't just physically hard, it was mentally a tough match. It was pretty stressful."

After a quiet start Raonic put Murray under pressure and pounced in the 11th game when his opponent's forehand deserted him and he dropped serve with a double fault.

Raonic, showing great variety as well as power, was in full control as he broke to lead 2-1 in the second set when a weary Murray flopped a forehand into the net.

Murray slumped into his courtside chair, smiling wryly, but returned to win eight points in a row.

Raonic's serve began firing again though and he took the set into a tiebreak, coming back from 5-3 to 5-5 before his rival played a cool volley and took the set with a big serve.

Twice Murray served for the match in the decider, at 5-4 and 6-5. Twice Raonic gallantly broke back.

It was 127 apiece in points as the tiebreak began. Neither player deserved to lose but Murray, as he always seems to do, found a way to set up what he said will be "the perfect finish".

Brother Jamie's hopes of celebrating his number one doubles status with the ATP title ended as he and Bruno Soares lost to Raven Klaasen and Rajeev Ram who will now face Henri Kontinen and John Peers in the final.

(Editing by Tony Jimenez)