Italy's world-record 37-game unbeaten run came to an end as Spain beat them in an enthralling encounter at the San Siro to reach the Nations League final.
Albeit in Uefa's secondary tournament, Spain got a measure of revenge for their Euro 2020 semi-final penalty shootout defeat by eventual winners Italy at Wembley.
Manchester City's Ferran Torres scored Spain's goals in Milan from two Mikel Oyarzabal crosses to send Luis Enrique's side to Sunday's final against either Belgium or France.
Italy were already second best, and 1-0 down, when captain Leonardo Bonucci was sent off for two bookings, the second for an elbow on Sergio Busquets.
They looked dead and buried until Lorenzo Pellegrini's late goal after a wonderful Federico Chiesa run on a counter-attack - but could not find an unmerited equaliser.
Spain handed 17-year-old Barcelona midfielder Gavi a start, making him the youngest international in their history - less than six weeks after his club debut - and he looked at home on this stage.
The Nations League may be a fairly new tournament - and derided by some - but when both sides had 11 men this was played with the talent and intensity of any World Cup or European Championship encounter.
This also marks the first time Italy have lost a competitive game in their homeland since 1999.
Torres shows his importance to Spain
Torres has become one of Spain's star men in the past year or so. This was his 11th international goal since 1 September 2020. Nobody else has scored more than five.
He is clinical too, with six of his last seven shots on target for Spain ending in a goal. He only had two shots in this game.
His first was a lovely volley - at a difficult height - and his second a header back across goal, both from Oyarzabal balls into the box.
He was replaced early in the second half by teenage debutant Yeremi Pino, presumably with a knock.
But the game was done by that stage, especially with Italy down to 10 men. Roberto Mancini brought on veteran defender Giorgio Chiellini for attacker Federico Bernardeschi at half-time as the hosts looked for some damage limitation.
They only had one shot in the second half - when Chiesa ran from his own half after Spain committed men forward and unselfishly squared for substitute Pellegrini.
Spain gave Italy their most difficult game at Euro 2020 when they wasted a load of chances before losing on penalties.
But they got the win they deserved this time. There was the strange situation too of Italy goalkeeper Gianluigi Donnarumma, who was named the best player at Euro 2020, but was booed throughout by his own fans. He left San Siro occupants AC Milan for Paris St-Germain in the summer.
It appeared to affect him at times, most notably when he fumbled Marcos Alonso's volley on to the post moments after the opening goal.
Italy will face the losers of Thursday's game between Belgium and France at Juventus' stadium in Sunday's third-placed play-off at the same venue (14:00 BST).
Spain face the winners at the San Siro at 19:45 BST.
Line-ups
Italy
Formation 4-3-3
21G Donnarumma
2Di Lorenzo19Bonucci23Bastoni13Emerson
18Barella8Jorginho6Verratti
14Chiesa20Bernardeschi10Insigne
21G Donnarumma2Di Lorenzo19BonucciBooked at 42mins23Bastoni13Emerson18BarellaSubstituted forCalabriaat 72'minutes8JorginhoSubstituted forPellegriniat 64'minutes6VerrattiSubstituted forLocatelliat 58'minutesBooked at 81mins14Chiesa20BernardeschiSubstituted forChielliniat 45'minutes10InsigneSubstituted forKeanat 58'minutesSubstitutes
1Sirigu3Chiellini4Calabria5Locatelli7Pellegrini9Raspadori11Berardi12Dimarco15Acerbi16Cristante17Kean22MeretSpain
Formation 4-3-3
23Simón
2Azpilicueta19Laporte3Torres17Alonso
9Paez Gaviria5Busquets8Koke
11Torres22Sarabia21Oyarzabal
23Simón2AzpilicuetaBooked at 45mins19Laporte3Torres17Alonso9Paez GaviriaSubstituted forRobertoat 83'minutes5Busquets8KokeSubstituted forMerinoat 75'minutes11TorresSubstituted forPinoat 49'minutesBooked at 71mins22SarabiaBooked at 65minsSubstituted forGilat 75'minutes21OyarzabalBooked at 89minsSubstitutes
1de Gea4Martínez6Gil7Pino10Roberto12García13Sánchez14Reguilón15Porro16Rodri18Fornals20MerinoLive Text
Match ends, Italy 1, Spain 2.
Second Half ends, Italy 1, Spain 2.
Corner, Spain. Conceded by Gianluigi Donnarumma.
Foul by Aymeric Laporte (Spain).
Moise Kean (Italy) wins a free kick in the attacking half.
Attempt blocked. Bryan Gil (Spain) right footed shot from a difficult angle on the right is blocked. Assisted by Sergi Roberto.
Foul by Mikel Oyarzabal (Spain).
Giorgio Chiellini (Italy) wins a free kick in the defensive half.
Foul by Bryan Gil (Spain).
Giovanni Di Lorenzo (Italy) wins a free kick in the defensive half.
Yeremi Pino (Spain) wins a free kick in the defensive half.
Foul by Alessandro Bastoni (Italy).
Mikel Oyarzabal (Spain) is shown the yellow card for a bad foul.
Foul by Mikel Oyarzabal (Spain).
Davide Calabria (Italy) wins a free kick in the defensive half.
Corner, Spain. Conceded by Alessandro Bastoni.
Corner, Spain. Conceded by Emerson.
Mikel Merino (Spain) wins a free kick in the attacking half.
Foul by Federico Chiesa (Italy).
Substitution, Spain. Sergi Roberto replaces Gavi.