Defending champion Roger Federer was eliminated from the Masters Cup today with a 4-6, 7-6 (3), 7-5 loss to Andy Murray, one of those rare players with a winning record against the Swiss star.

SHANGHAI, China — Defending champion Roger Federer was eliminated from the Masters Cup today with a 4-6, 7-6 (3), 7-5 loss to Andy Murray, one of those rare players with a winning record against the Swiss star.

Federer, a four-time winner of the season-ending tournament, appeared to be bothered by a sore back that forced him to withdraw during the Paris Masters two weeks ago. Federer received treatment from the trainer three times during the match.

"I don't quit once I step on court," said Federer, who noted he had a stomach ailment earlier in the week. "Normally, best-of-three match, it's peanuts. So it was a pity I couldn't handle it today. Pretty happy I don't have a match tomorrow, to be honest."

Federer saved seven match points while serving at 4-5 before Murray converted two games later, breaking when Federer sent a forehand long.

"A win over Roger Federer means almost as much as winning the Masters Cup to me," said Murray, who improved to 4-2 against him. "He's the best player of all time."

Murray, who had his left hand iced during the match, will play Nikolay Davydenko in the semifinals. Federer's loss allowed Gilles Simon to advance and play Novak Djokovic.

The ninth game of the third set lasted 17 minutes and went to 10 deuces. Federer fended off the last of the seven match points with an ace, then blasted another before Murray sent a forehand long.

"When you play against Roger, you got to expect him to play some great stuff, especially when he's behind," Murray said. "He hit a couple of aces, a couple of big forehands. I missed a couple of returns I maybe shouldn't have."

Federer tried to force a tiebreaker, but he committed three forehand errors while serving at 15-15.

Murray already had clinched a semifinal spot from the Red Group. But he lived up to his promise not to take it easy, wanting to avoid the prospect of facing Federer again if both were to make the final.

Federer was trying to repeat last year's feat of rallying after losing his opening-round match.

"I almost made a miracle happen, you know," Federer said. "I can't believe how close I got, to be honest. So I'm actually very happy."

The atmosphere was more akin to a final than the last match of group play. Qi Zhong stadium was packed, and while the crowd overwhelmingly favored Federer, Murray has won over a lot of fans.

The two players exchanged breaks in the middle of the first set. Then, with Murray serving at 4-5, Federer broke at love.

Murray broke in the opening game of the second set, and again to pull ahead 5-2. He had double-set point while serving in the next game, only to see Federer rally to break.

The Swiss star secured triple breakpoint with Murray serving for the set at 5-4. Murray forced deuce, but Federer whacked a clean forehand winner to set up another break chance, and Murray double-faulted to make it 5-5.

Federer rallied from a 3-1 deficit in the tiebreaker to even it, but Murray ran off the last four points.

Federer had the trainer come out and massage his lower left back as he lay face down on the court during the break, then during the next two changeovers and frequently rubbed the area during the match. At one point, he sat in a linesman's chair while waiting for Murray to start a service game.

Murray broke him while taking a 3-0 lead, but Federer ran off four straight games. Murray broke the next game to even it at 4-4, with Federer hitting a routine overhead way long on break point.

Federer began the year recovering from a bout of mononucleosis. He lost the French Open and Wimbledon finals to Rafael Nadal, who overtook him for the No. 1 ranking.

Federer won the Olympic doubles gold in August, and a month later captured his fifth straight U.S. Open title to pull within one of Pete Sampras' record of 14 Grand Slam titles.

"It's been a good year, you know," Federer said. "Tough to start off with. Tough to end. But I think it gives me the opportunity to start over all new again next year."