Cesc Fabregas was the hero again as Spain kept alive their hopes of defending the European title with a dramatic shootout win in Dontesk.
The Barcelona midfielder put Spain into Sunday's Euro 2012 final, drilling his penalty in off the left-hand post to spark scenes of jubilation.
Joao Moutinho and Bruno Alves missed for Portugal, with Cristiano Ronaldo a frustrated, unused fifth penalty-taker.
The match finished 0-0 after extra-time with neither side doing enough to win.
It took until half past midnight local time to get there, but Fabregas, who had scored the winning penalty in the Euro 2008 quarter-final win over Italy, ensured Spain proceeded to a final against Germany or Italy on Sunday and remain on course for an unprecedented third successive tournament victory.
The world champions have now won their past nine knockout games at major tournaments without conceding a goal, and are unbeaten in their last 19 competitive matches.
Neither side had produced their fluent best during only the second 0-0 draw of the tournament. At times it was a bad-tempered affair and the apparently inevitable shootout made a nervy start as goalkeepers Rui Patricio and Iker Casillas denied Xabi Alonso and Moutinho respectively in the first round.
Andres Iniesta calmly put Spain in front, only for Pepe to keep Portugal on terms with a clinical low finish. Spain defender Gerard Pique found the bottom left-hand corner of the net, but Nani responded by firing his spot-kick high into the roof of the net to make it 2-2.
But when Spain's Sergio Ramos nonchalantly chipped his penalty beyond Patricio and Alves hit the bar for Portugal, it was left to Fabregas to send Spain into the final and spark memories of 2008 when their footballing history changed forever as a nation remembered how to win.
It had been billed as a clash of Ronaldo, the ultimate individualist, and Vicente Del Bosque's finely tuned orchestra - Ronaldo against Spain, Real Madrid against Barcelona, individual brilliance against the collective mastery of the defending world and European champions.
What nobody had accounted for, however, was Spain playing out of tune for long periods - Portugal were the conductors as inspiration gave way to perspiration in Donetsk.
Ronaldo was a constant danger. But at no stage did Spain man-mark him, subject him to rough-house treatment or even cut off the supply from the excellent Moutinho.
Spain's plan simply was to use the ball to mark Ronaldo, controlling the match through possession in an attempt to render him impotent.
Portugal had other ideas. Their physicality and unswerving desire in midfield prevented Spain settling into their familiar rhythm. At every turn, Xavi and Iniesta found a willing opponent, pressing Spain high up the field and forcing mistake after frustrating mistake.
There were warning signs that Spain might find their rhythm when Iniesta linked up with Jordi Alba down the left flank after eight minutes. The Barcelona midfielder collected Alba's pass, drifted beyond two defenders and cut the ball back only for Alvaro Arbeloa to thump a first-time shot over the bar from the edge of the area.
Opportunities such as that soon became the exception rather than the rule, however. Tempers flared at times, passes were misplaced and Portugal grew in confidence.
Ronaldo's confidence was never in question. After 12 minutes, he reduced Gerard Pique to vain pursuit, surging beyond the Barcelona defender with that remarkable power steering only for his delicate cross to be picked off Nani's head by goalkeeper Casillas.
A left-foot snap-shot found the side netting and, with half-time approaching, he spun away from Sergio Ramos, winning a free-kick and responding with that chest-out, hands-on-hips pose he has trademarked. Ronaldo was in the mood.
Spain were out of their comfort zone but their individual brilliance made them a danger on the rare occasions they did attack. Iniesta and Xavi combined well midway through the first half only for the former to curl his shot agonisingly over the crossbar.
After an hour Del Bosque had seen enough, abandoning his original plan to use a traditional centre forward in Alvaro Negredo by introducing Fabregas. The ineffective David Silva also made way for Jesus Navas as Spain sought width.
Briefly, Xavi began receiving the ball in advanced positions more regularly, showing the poise and the grace to dribble into dangerous areas.
At the other end, Ronaldo thumped a dipping free-kick over the bar after 73 minutes but Portugal's raids were growing more infrequent as they were forced to rely on set-pieces. Ten minutes later, Ronaldo repeated the trick and, as the game ticked into injury time, the Real Madrid man had a chance to win it.
Portugal broke like a sprint-relay team as a Spain free-kick was cleared. The tireless Miguel Veloso found Raul Meireles, but the Chelsea man's pass forced Ronaldo to check his run down the left flank, and his shot was dragged wide.
Fatigue was beginning to show in Portugal's play and it was Spain who revived in extra-time to come as close as at any point to breaking the deadlock.
Navas might have done better with a shot, from which Alba collected and picked out Iniesta's surging run only for the midfielder to see his close-range shot pushed round the post.
Ramos thundered a free-kick inches over the bar from 30 yards moments later, before Patricio was forced into action again, turning Navas's fierce low shot away.
It was all Spain now, and Fabregas put Pedro through on goal with a delightful touch on the half-way line but Portugal flooded back before the Barcelona forward could pull the trigger.
It was a moment that encapsulated the contest - Spain pushed for a winner, desperate to avoid penalties but Fabregas ensured they need not have worried.