LONDON (AP) -- Milos Raonic withdrew from the ATP Finals with a quad injury before his final round-robin match against Japan's Kei Nishikori on Thursday.

The seventh-seeded Raonic, who lost his first two matches in Group B in straight sets, will be replaced by Spain's David Ferrer, the first alternate at the year-end tournament.

''As badly as I wanted to play, you've got to be at the top of your game here and I couldn't be close to that today,'' said the big-serving Canadian. ''Wouldn't have been fair to the fans if I had played a mediocre match or had to stop.''

Six-time champion Roger Federer will take on Andy Murray in the group's other match. If the 17-time Grand Slam champion beats Murray and Nishikori defeats Ferrer, then the Scot will be eliminated from the indoor event.

Ferrer, who trained in London this week, has no chance of making it to the semifinals. At the Paris Masters last month, he saw his hopes of qualifying for the Finals vanish after losing a tough battle to Nishikori in the quarterfinals. The Spaniard came within two points of victory but failed to hold on to his lead.

Raonic, one of the three newcomers in London with Marin Cilic and Nishikori, said he picked up his injury during his defeat to Murray.

''I have a slight tear in my quad and a large area of swelling,'' he said. ''I've had a great time here. It motivates me a lot to come here next year and do better than I did.''