Alexander Zverev ended a frustrated Roger Federer's hopes of a third Shanghai Masters title as he claimed a stunning 6-3, 6-7 (7-9), 6-3 quarterfinal triumph.
The German took his head-to-head record against the 20-time Grand Slam champion to 4-3 with a display of immense quality and huge character.
Federer, winner of the title in 2014 and 2017, frequently showed his displeasure and repeatedly argued with the umpire, even landing a point penalty after hitting the ball into the crowd in anger.
But his unrest was largely down to the brilliance of Zverev, who defiantly overcame the setback of missing out on five match-point openings in the second set.
The result came after reigning champion Novak Djokovic had already been dumped out by Stefanos Tsitsipas.
It was Zverev who forged ahead, seizing on a break-point opening that came after a stinging forehand return winner.
He then confidently held serve for a 5-2 lead as Zverev continued to look the more settled of the two, a fact further underlined when he served out the final game of the set to love.
Federer offered a swift riposte at the start of the second set, clinching a break after settling a lengthy rally with a deft drop shot that Zverev could only lob wide on the stretch.
But Zverev refused to wilt and, showing remarkable power and accuracy to dictate matters from the baseline, he clawed his way back to level terms.
Serving at 5-5, Federer failed to land a first serve and found an inspired Zverev on the other side of the net, the 22-year-old battling hard to stay in a point that he ended up winning with a glorious, laser-like forehand down the line.
Federer produced his best tennis at 40-0 down, rescuing himself from the brink with a series of inspired shots to force a tie-break in which he survived two more match points before levelling things up.
To Zverev's credit, he was soon back on the offensive and raced into a 3-0 lead in the decider, dropping only two points in the process.
He clung fiercely to that advantage against an uncharacteristically irritable Federer, who was docked a point in game four after striking a ball away in anger, having already been warned for doing so earlier.
Despite saving the two break points that resulted from that penalty, there was no way back for Federer as Zverev sealed a memorable win in a contest lasting more than two hours.