Kei Nishikori has booked his spot in the semi-finals of the Miami Masters by beating Roger Federer 3-6 7-5 6-4 in an enthralling last-eight meeting.
The Japanese ace was pushed all the way in his first service game, but he held his nerve to save two break points on his way to getting on the scoreboard.
However, the 20th seed handed the advantage to Federer just a few minutes later when the former world number one secured the first break of serve in the match.
Despite handing Nishikori a way back into the set with a poor service game of his own, Federer managed to break his opponent once more on his way to success in the opener.
Breaks of serve proved to be a common theme as the pair traded breakthroughs early in the second set, with Federer's first-serve percentage dropping below 50% for most of the contest.
The fifth seed allowed another lead to slip away by losing his serve just moments after breaking in the seventh game of the set.
Nishikori made the crucial play by claiming a break at the end of the second set to win 7-5, taking the match into a decider.
The third set stayed with serve for nine games as both players looked for the vital breakthrough which would give them control of the quarter-final clash.
Federer was forced to save two match points on his own serve, but he was unable to avoid defeat as Nishikori took his third opportunity to knock out the 18-time Grand Slam winner with a backhand winner.