Novak Djokovic has left the chasing pack breathing in his fumes this season, but he spluttered at the ATP World Tour Finals in London on Tuesday as Roger Federer ended his 23-match winning streak with a 7-5, 6-2 group stage victory.

The world number one would probably have beaten most players, even with the errors piling up and his serve out of sync, but not Swiss great Federer who sealed a semi-final spot with a match to spare.

Federer has now been responsible for three of Djokovic's six defeats this season, edging ahead 22-21 in their career rivalry.

Djokovic's first indoor loss since 2012, in which time he has won three consecutive London year-enders, means he needs to beat Czech Tomas Berdych on Thursday to be sure of joining Federer in the semifinals.

Japan's Kei Nishikori beat Berdych 7-5, 3-6, 6-3 in the day's early offering, the first three-set match so far.

While it earned world number eight Nishikori another $167,000, the reward for a group win, it is likely to prove in vain unless he beats Federer in his final match and Berdych defeats Djokovic.

Djokovic could even scramble through with a three-set defeat, providing Nishikori does not win.

Djokovic had been untroubled until the 12th game when Federer earned a couple of set points, converting the second with a sublime half-volley dink off a dipping Djokovic backhand.

A tired-looking Djokovic backhand slice into the net gave Federer a 2-0 lead in the second set, and although the Swiss six-time champion gifted back the break, he raced away to a 5-2 lead and claimed victory on his second match point.

Nishikori and Berdych provided the match of the tournament so far -- an absorbing duel full of eye-catching rallies.

World number eight Nishikori was in trouble when he faced a break point at 3-3 in the deciding set but he weathered a barrage of Berdych power to fend it off before going on to claim his first win in Stan Smith Group.

"That was a really big point. He had three, four shots that he went really aggressive. I was defending all the time. I mean, last shot, I kind of went for it, closed my eyes."

"Was a little bit lucky I made that shot."

World number six Berdych, beaten by Federer in his opening match, squandered a great chance in the first set when Nishikori was serving at 4-5 15-30, missing a wide-open court with a backhand at the end of a brilliant rally.

It proved costly as Berdych dropped serve in the next game and Nishikori clinched the set with a pinpoint forehand.

The 30-year-old Berdych reeled off five successive games on his way to win the second set and the decider was toe-to-toe, before the Czech flinched first.