Britain's Andy Murray saw off Stanislas Wawrinka in three sets to set up a Toronto Masters quarter-final against defending champion Novak Djokovic.
Ninth seed Murray beat the 10th-ranked Wawrinka 6-2 0-6 6-4, despite losing seven straight games at one point.
The 21-year-old began and ended his match in style, after suffering an alarming mid-match slump that saw him drop the second set to love.
He broke twice in succession at the start of the match, with his forehand particularly impressive, and when Wawrinka, 23, called for the trainer at 4-0 down a retirement looked on the cards.
But the Swiss carried on and, after saving two break points at the start of the second set, he began to find some form.
A magnificent running forehand and a blistering return winner helped him to a double break, and Murray put little effort into preventing the love set as his focus switched to the third.
The key moment came in the second game of the decider when Wawrinka failed to convert three break points, despite the increasing anger and frustration of a struggling Murray.
Wawrinka could not maintain the form of the second set, and at 3-3 the errors crept back into his game to hand Murray the crucial break.
The Scot was back in the mood now and he served out superbly to seal a clash with Djokovic.
"I played really well at the start and I felt like I was hitting the ball great," said Murray.
"Early in the second set I had a chance to break him and obviously didn't.
"He started to pick his game up and it actually got very windy and I started to miss quite a lot of balls, mis-hit a few - I think I missed the ball completely three or four times.
"But I had to stay tough in the third set because he was playing much better.
"I've played Stan quite a few times, we're really good friends, and when I have played him in the past he's struggled a bit to close the matches out so I knew I had to keep fighting and I found some first serves when I needed them and made a few key returns.
"But it's tough to stay focused when you're making so many mistakes."
Murray is scheduled to return later on Thursday with his brother, Jamie, to take on Daniel Nestor and Nenad Zimonjic in the doubles.