It was the experienced Federer who came out on top, beating the Australian 7-6 (11-9), 6-7 (9-11), 7-6 (7-5) in a fascinating match.
Spain's 14-time Grand Slam champion won 6-1 7-5 to set up a tie with Roger Federer or Nick Kyrgios, who play their semi-final on Saturday at 00:00 BST.
"It did feel very good, because you don't very often play three breakers in a match", Federer said.
"So if it's Roger, it will just be another one for both of us, and that's it".
The shot stunned Federer and had the Miami crowd on their feet.
"Of course I'm thrilled for him as well that he came back as well as he did after the comeback, the struggles that he had a year ago", Federer added.
Kyrgios, 21, the flaky, flamboyant Aussie known for his trademark between-the-legs shots as well as for waging a constant battle between his ears, pulled out a thrilling, three-set victory over teenage phenom Sasha Zverev in a late quarterfinal Thursday.
In a match between the most popular man in tennis and the most misunderstood, the fans played a significant role in pushing Federer over the line.
"I know I can't always show my fighting skills because everything else sort of takes over". In the second, it was not about losing concentration, it's about not being lucky at the beginning of the second set. I had some ups and downs, a bit of a roller coaster.
Pilots: Dreamliner's first flight 'about as ideal at it gets'
Boeing will have three of the twin-aisle 787-10s in the test and certification program that is expected to last about a year. At the time of the roll-out in February, Boeing had 149 orders for the plane from nine customers.
It is the first time Miami will have a final between two players over 30 but no-one is expecting anything but the highest quality intense competition, especially with Federer enjoying such a rich run of form.
He said it would be "super special" to face Nadal again.
"I think the surface is good for him", Federer said before the tournament began.
In a shocking display of heckling the crowd roared and booed - including even Kyrgios' opponent Roger Federer's wife who was watching in the stands in Miami.
As for Federer, he needed three tiebreaks to advance past Kyrgios.
At 5-5, however, just when it looked as if Fognini might force a decisive third set, he double faulted and Nadal grabbed the break before sealing the match four points later. He has one of the best serves in the game.
This time, Federer was the one to go 3-1 down but he levelled, and finally got another stab at a match-point courtesy of a tense Kyrgios double fault.