After losing to the Italians in the last four of Euro 2020, two well-taken goals from Ferran Torres ended an unbeaten run which stretched back three years for Roberto Mancini's men.
Both were created by Mikel Oyarzabal, who produced a couple of sublime crosses for the Manchester City striker, as a young Spanish side dominated at the San Siro.
Their job was made easier by a first-half red card for Italy captain Leonardo Bonucci, who got his marching orders for a second yellow after elbowing Sergio Busquets.
But the home side refused to roll over and set up a tense finish when Lorenzo Pellegrini pulled one back late on.
In the end, though, it was a night to forget for the Azzurri, especially their goalkeeper Gianluigi Donnarumma - who was far from his best and produced a number of uncharacteristic sloppy moments.
Despite being the hero at Euro 2020, saving Bukayo Saka's decisive penalty at Wembley in the final against England, the Italian was on the receiving end of boos at the San Siro.
He can expect a frosty reception at the home of AC Milan after running down his contract and joining Paris Saint-Germain on a free transfer in the summer.