Britain's Andy Murray will face old rival Novak Djokovic for the first time since 2017 after beating Canada's Denis Shapovalov at the Madrid Open.
Murray, 34, produced a high level to win 6-1 3-6 6-2 against world number 16 Shapovalov, who beat the Scot at Wimbledon last year.
Now an even tougher test against world number one Djokovic awaits on Thursday.
Serbia's Djokovic started his campaign on the Madrid clay with a 6-3 6-2 win against France's Gael Monfils.
The 20-time Grand Slam champion will play Murray - who he has known since they were children and faced 36 times in their professional careers - in the last 16.
"He's the world number one and I've got a metal hip," world number 78 Murray told Amazon Prime. "I didn't know I'd get opportunities to play matches like this again. In theory I shouldn't have a chance in the match.
"But I've worked my hardest, put myself in a great position and it's a fantastic opportunity to play against him again on a big court in a huge tournament."
The 34-year-old Scot had planned to skip the clay-court season but reversed his decision last month when accepting a wildcard for Madrid.
After beating 2020 US Open champion Dominic Thiem in the first round, Murray had the chance to avenge his defeat against Shapovalov at Wimbledon last year.
Murray raced through the first set as he showed some of his best tennis since returning from major hip surgery three years ago - a particular highlight being a deft cross-court winner after racing from the baseline to the net.
After a tight start to the second set, Shapovalov fought off two break points at 2-2 and then took Murray's serve in the very next game on his way to levelling the match.
Murray maintained his fitness levels and his sharp movement, coupled with trademark determination, proved crucial in the deciding set.
At 12:34am local time, he sealed victory with his third match point and clinched back-to-back wins for the first time since reaching the Sydney final in January.
Earlier, Djokovic extended his 100% winning record over Monfils to 18 games - an ATP record for head-to-head dominance - and the victory also ensured he will remain at the top of the rankings.
The three-time Madrid champion is playing in only his fourth tournament of 2022 after not being allowed to compete at the Australian Open and events in the United States because he is unvaccinated against Covid-19.
"I'm still finding my form and my groove but I'm happy," said 34-year-old Djokovic.
Draper shows he can mix it with the best in defeat
Britain's Jack Draper, 20, was 3-0 up in the third set before falling short of an upset against world number eight Andrey Rublev.
World number 121 Draper has won four titles on the second-tier Challenger circuit this year - all on hard courts - and brought his momentum onto the clay at this prestigious Masters 1000 event.
But it was not quite enough against Rublev, who could face Dan Evans next after clinching a 2-6 6-4 7-5 win over Draper.
Left-hander Draper had been impressive in his opening match against Italian world number 27 Lorenzo Sonego on Sunday and against the even higher ranked Rublev he stayed composed when he was taken to a third set.
He surged to a 3-0 lead in the decider but was pegged back as his first serve lacked consistency and Russian Rublev, playing under a neutral flag because of sanctions relating to Russia's invasion of Ukraine, increased his level to win the contest after two hours and 19 minutes.
Last year Draper took a set off eventual champion Djokovic at Wimbledon and also stunned Italian third seed Jannik Sinner at Queen's and his two performances in Madrid are further evidence of a promising future.