Andy Murray beat highly-rated Spanish teenager Carlos Alcaraz 5-7 6-3 6-2 to reach the third round at Indian Wells.
Murray raced into a 3-0 lead but was pegged back to 4-4 and, after failing to take a set point on the Alcaraz serve at 5-4, lost the opening set.
But he levelled at one-set all - even serving underarm at one point.
Murray, 34, broke twice in the decider on the way to taking a captivating match against the 18-year-old in three hours and three minutes.
The victory will provide Murray, who is 121st in the men's rankings, with plenty of encouragement as he continues his latest comeback after four disrupted years following a major hip injury.
"It was a brutal match, really tough conditions," Murray told Amazon. "The way I fought after losing the first set was great because I feel I should have won that first set.
"I created lots of chances but didn't take them. It would've been easy to let that slip away but I kept fighting and finished it well."
Alcaraz, ranked 38th in the world, beat Stefanos Tsitsipas at the US Open in September and looked like he was ready to impose himself on the match after taking a 67-minute first set.
But he could not shake off a resilient Murray, who came back from 15-40 down on his serve in the third game of the second set before audaciously taking it with an underarm ace.
"The courts are painfully slow here," added Murray. "I was thinking about using it [the underarm serve] again in the third set.
"He changed his return position towards the end of the first, he started going further back and I was like 'just give it a go and see'.
"I used it, it worked well and maybe I'll use it again in the future if guys are going to stand that far back and they're going to make courts like this."
Murray went on to level the match and, having broken Alcaraz in the first game of the deciding set, found himself 15-40 down on his serve again, only to fend off his rival in a game of 10 minutes 32 seconds to consolidate his break.
Murray then broke Alcaraz once again and secured an impressive win as he served and volleyed to take match point.
He will play Alexander Zverev or Jenson Brooksby in the next round.