Andy Murray overcame the sporadic brilliance of Richard Gasquet to reach the Sony Open final.
The Briton won 6-7 (3-7) 6-1 6-2 and will take on world number five David Ferrer in Sunday's final in Miami.
"It was a very tough match," Murray told BBC Sport. "I was just happy to come through in the end."
Victory over Ferrer would see Murray move back to number two in the world - at the expense of Roger Federer - for the first time since 2009.
It would also bring him a ninth Masters title and a second in Miami, following his success in 2009.
"It will be a tough match," Murray said of the final. "He (Ferrer) has had a great week; he's in great shape. He's always tough to play against."
Murray, 25, had won three of his last four matches against Gasquet and again proved the stronger as the world number 10 managed to find his potentially devastating attacking game only for brief periods.
Gasquet, 26, opened with a flurry of spectacular backhand winners and Murray found himself 3-0 down in a little over 10 minutes, but he weathered the early storm.
He has twice beaten the Frenchman from two sets down at Grand Slam tournaments, and remained unruffled, breaking back to love with a forehand pass down the line and levelling at 3-3 with his third ace.
Murray was now serving impressively and backing it up with some heavy firepower from the baseline, breaking once again at 4-4, and Gasquet then launched a furious tirade towards the umpire over a time violation.
Everything appeared to be going Murray's way, but he handed the initiative back with a desperately poor game when serving for the set, double-faulting on break point.
It ultimately cost him the set after Gasquet controlled the tie-break, two fabulous half-volleys and a sharp forehand volley helping him to 6-3 before Murray sent a backhand wide.
The early stages of the second set did not provide much encouragement for Murray, but a brilliant forehand off a Gasquet smash gave him renewed impetus and two more thumping forehands moved him 3-1 ahead.
Murray raced through the next three games to draw level and Gasquet appeared to be struggling physically, requiring the trainer to tape his toes before heading into the decider.
An increasingly tentative Gasquet was camped well behind the baseline and dropped serve at the start of the third set, slamming his racquet on the ground in the frustration after another miss, only for Murray to give up his advantage once again with a double-fault.
Murray was understandably angry with himself and took it out on his opponent with a blistering forehand return and a lunging volley to break for 2-1, and he barked encouragement to himself on his way back to the chair.
There was no more in the tank for Gasquet and a forehand into the net gave up the double-break, allowing Murray to serve out in relative comfort after one hour and 59 minutes.
"The first set was a tough one to lose," said Murray. "I hit something like 20-odd winners, so to lose it was tough.
"He came up with some unbelievable shots at times, especially in that tie-break.
"I felt like I was dictating a lot of the points but just made a few unforced errors on the backhand side at the end. I did well in the second and third sets to keep up my intensity."
Ferrer earlier brought an end to the surprise run of 34-year-old Tommy Haas, who had beaten world number one Novak Djokovic on his way to the last four and was aiming for his first Masters Series final in 11 years.
The German led 3-1 in the final set, only for Ferrer to fight back for a 4-6 6-2 6-3 victory.