Spain players celebrate as they advance to the Euro 2012 final.
Fabregas fired his shot in off the post to send Spain through after Bruno Alves had hit the bar for Portugal.
The Spaniards had started better, and ought to have gone ahead from their first chance in the ninth minute when Manuel Negredo pulled the ball back for Alvaro Arbeloa to fire over the bar from the edge of the box.
They almost grabbed the lead in the 29th minute, when Xavi's clever ball found Iniesta on the edge of the box, who rolled the ball onto his right foot before floating a shot inches over Rui Patricio's goal.
Portugal had been controlling the game for the large part though, and that continued into the second half, with Nani almost picking out the head of Hugo Almeida from a dangerous right wing cross, which proved enough for Vicente Del Bosque, who replaced Negredo with Fabregas up front.
Belatedly, Spain started to show signs of stirring, Xabi drilling a shot straight at Patricio from long range, but despite beginning to edge possession, chances continued to be few and far between.
Then came a glorious chance for Ronaldo in the last minute of normal time, when a Portuguese counter-attack saw Raul Meireles feed the Real Madrid man who fired over the bar from the left side of the box.
The introduction of Pedro lent some urgency to the Spanish attack in extra-time, and his run set up a chance for Iniesta in the seventh minute of the extra half hour, but his low shot was blocked in the box.
As Spain kept pressing, Pedro briefly burst clear before being caught by Fabio Coentrao, but by then there was a certain inevitability about a match that promised much but offered little heading to penalties.
Alonso had the first spot-kick saved by Patricio but Casillas evened things up by saving the first Portuguese penalty from Moutinho.
Iniesta, Pepe, Pique, Nani and Sergio Ramos all put away their penalties before Alves - who had inadvertently stepped up for the previous penalty which was eventually converted by Nani - hit the bar, leaving Fabregas to put Spain through.
Spain will meet the winner of Thursday's match between Germany and Italy on Sunday.