The Austrian will meet 23-year-old Daniil Medvedev in Sunday’s final after the Russian also pulled off a surprise by edging out fourth seed Kei Nishikori 6-4 3-6 7-5 in a tight match.
Thiem had lost his last two matches against world number two Nadal, at Roland Garros as well as a thrilling five-setter in the U.S. Open quarter-finals.
He, however, won their last meeting on Spanish soil, beating the Mallorcan in last year’s Madrid Open.
The Austrian, ranked fifth in the world, broke Nadal to take a 3-2 lead in the opener and held in the next game thanks to a stunning crosscourt forehand winner before seeing out the set.
He broke Nadal again in the fifth game to lead 3-2 and edged towards victory by taking a 30-15 lead before Nadal pulled himself back into contention by winning the next three points.
Thiem was serving for the match but Nadal dug deep to earn three break points only to lose each one.
Thiem levelled the game with an ace after a marginal call from the umpire.
He sealed his fourth career victory over Nadal in 12 matches with a softly-struck backhand which the Spaniard had no chance of reaching.
The defeat ended Nadal’s chances of a fourth consecutive Barcelona Open title.
Thiem will now meet Medvedev, who clinched an entertaining match that lasted two hours and 25 minutes against Nishikori, in the final.