Favourites Spain will face Brazil in the Confederations Cup final after a dramatic 7-6 penalty shoot-out victory against Italy in Fortaleza.
Spain substitute Jesus Navas drilled in the decisive penalty after Italy defender Leonardo Bonucci missed.
Italy dominated much of the 90 minutes but were left to pay for their misses.
Emanuele Giaccherini hit the Spain post in extra-time, while Gianluigi Buffon pushed Xavi's shot on to the woodwork.
Each of the first 12 penalties were converted in a high-quality shoot-out before Bonucci blasted his effort over Iker Casillas's crossbar.
His miss allowed new Manchester City winger Navas to coolly convert past Buffon to set up an eagerly anticipated clash against the host nation, 2-1 winners against Uruguay in their semi-final, in Rio de Janeiro on Sunday.
But the complexion of the match would have been totally different had Italy, without injured striker Mario Balotelli, not squandered a host of goalscoring chances.
The Azzurri dominated a high-tempo first half as the tactical instructions of boss Cesare Prandelli - to stay tight and compact defensively before breaking quickly down the Spanish flanks - were carried out to perfection.
Spain, who beat their opponents 4-0 in the Euro 2012 final, looked vulnerable as they failed to cope with the Italian raids, but were left unpunished.
Italy wing-back Christian Maggio was the outstanding performer in a frenetic first half as he worried Spanish left-back Jordi Alba with his pace and movement down the right flank.
The Napoli player missed three gilt-edged chances, notably when heading straight at Casillas from six yards when unmarked, as well as creating spurned opportunities for Alberto Gilardino and Claudio Marchisio.
The stern expression etched across coach Vincente del Bosque's face as the game approached half-time epitomised Spain's worries.
Having guided the world and European champions to a record 28 competitive matches without defeat, the veteran coach has rarely seen his side struggle. But, despite his half-time intervention, their lethargic approach continued after the interval.
Italy, backed by a large vocal support inside the Estadio Castelao, continued to press with Marchisio denied by a desperate block from Gerard Pique and Giorgio Chiellini heading Andrea Pirlo's corner onto the roof of the Spanish net.
However, the energy of the hard-working Italians started to wane as they felt the effects of sweltering temperatures in northern Brazil.
Spain found renewed energy as the game entered extra-time - Xavi and Andres Iniesta pushing and probing the tiring Italian defence with their slick interchanges.
Pique saw a shot blocked, Daniele De Rossi poked clear away from Sergio Ramos and the Real Madrid defender then lashed over as Spain piled on the pressure with a succession of corners.
In the final moments of extra-time, Italy captain Buffon unconvincingly pushed Xavi's arcing long-range shot onto his left-hand post and escaped further punishment when Javi Martinez steered the rebound wide.
Seconds later, Navas's drilled cross was palmed away by Buffon as the Italians held out for penalties after a breathless finale.
Buffon and Casillas were virtual bystanders in a shoot-out full of cool finishes, but it was Spain who were left celebrating after Navas's winner and they travel to Rio aiming to add the Confederations Cup to their trophy haul.
Ahead of the match, for rioting outside the stadium in Fortaleza.