(CNN) -- Andy Murray will need to beat Fernando Verdasco on Thursday to reach the semifinals of the ATP World Tour Finals after going down 3-6 6-3 6-1 to Roger Federer in Tuesday's blockbuster Group A clash at London's O2 Arena.
The British number one played superbly to take the first set but Federer was in terrific form and Murray simply had no answer in the second half of the match.
The victory means Federer is certain to finish the year as world number one once again.
Federer and Murray had met three times this year, with the Scot triumphing twice, while he also beat the Swiss in the round-robin stages of this tournament last year.
That defeat meant Federer, who won the end-of-season event four times from five successive finals between 2003 and 2007, failed to qualify for the semifinals.
But from the first point on Tuesday -- a superb rally that ended with a Murray mis-hit -- the world number one seemed determined to avoid a repeat.
Two break points followed, of which Federer took the second when Murray netted, but, with a packed crowd in great voice, the home favorite promptly broke straight back.
The noise level was a big step up from anything heard at the O2 so far in the tournament and they were seeing tennis to match.
Murray was taken to deuce in the fifth game but kept his nerve, and three points later he found himself at 0-40 on the Federer serve, taking the second opportunity.
Federer had two chances to break back straight away only for the fourth seed to pull out two big serves before polishing off the game with a Pete Sampras-style 'slam-dunk' smash.
The 22-year-old then clinched the set two games later, despite a wobble that saw him pulled back from 40-0 to deuce.
Despite winning the first set, Murray had been under pressure in almost every service game and that pattern continued in the second, with the Scot saving a break point in the second game.
It seemed inevitable Federer would eventually break through and so it proved in the sixth game, the world number one stringing together a series of sublime points. Murray had an opening in the next game but it was swiftly snuffed out, one stunning half-volley from Federer drawing gasps from the crowd.
Despite the best efforts of his opponent, the 28-year-old duly served out the set to level an enthralling match.
The decider promised to be a thriller but Murray's hopes of booking that last-four spot, which became possible following Juan Martin del Potro's victory over Fernando Verdasco, took a blow when he slipped to 0-40 in the third game.
And this time there was to be no escape, Federer chipping and charging on his third opportunity to force the error from Murray.
Murray was clearly feeling the pressure on his serve and a seventh double fault moved Federer to within a point of a double break.
He took it thanks to a Murray volley that flew long and at 4-1 there was no way back for the 22-year-old.
With the backing of the majority of his home crowd, Murray battled hard in an attempt to at least force Federer to serve it out, but the man from Basle was not to be denied and he clinched victory on his third match point.