Italy triumphed with goals from Giorgio Chiellini and Graziano Pelle and will face Germany in the quarter-finals.
The Italians, who had not won a competitive match against Spain since the 1994 World Cup and were humiliated 4-0 by their old rivals in the Euro 2012 final in Kiev, were the better side, especially in the first half, on a damp evening.
Italy, who were better organised and more aggressive before the break, had wasted several chances when defender Chiellini put them ahead after 33 minutes, following up to tap in after goalkeeper David De Gea failed to block Eder’s free kick.
The Italians suffered in the second half and had been resisting sustained Spanish pressure when striker Pelle connected with a Matteo Darmian cross to volley home from close range, doubling their advantage in added time.
Spain’s defeat marked the end of an era for a side who had established themselves as the dominant force in Europe by winning the European Championship in 2008, after knocking out Italy in the quarter-finals, and repeated the success in 2012.
The Spaniards, who struggled to impose their trademark, quick passing game on a slippery pitch, had already suggested they were on the way out when they lost their world crown with a shock group-stage exit from the 2014 World Cup in Brazil.
Italy, who had won one of their past 11 games against Spain and whose ageing side had been written off by many in the build-up to the tournament, face Germany on Saturday in Bordeaux in another battle of the heavyweights for place in the semi-finals.
Chiellini’s goal was the first conceded by Spain in the knockout stages of a European championship or a World Cup since a 3-1 defeat by France in the last 16 of the 2006 World Cup.
The first clear chance of Monday’s game at the Stade de France came to Italy after a few minutes when Pelle’s header from Alessandro Florenzi’s free kick forced De Gea to save.
The Spain keeper was made to work again soon after when he turned an overhead kick by Emanuele Giaccherini on to the post.
Spain, whose 15-match unbeaten run in European Championship finals ended with a 2-1 defeat by Croatia in their final group game, did not manage a shot on target until a harmless effort by Andres Iniesta shortly before the half-hour.
The holders showed more initiative after the break and came close with a header by Alvaro Morata directed straight at Italy keeper Gianluigi Buffon early in the second half.
The Italians, however, remained dangerous and would have doubled their lead earlier had Eder not lost out in a one-on-one with De Gea after being set up by a Pelle flick on the hour.
Spain kept plugging away and missed another good opportunity 15 minutes from time when Iniesta struck a volley that Italy captain Buffon did well to punch out.
The experienced keeper was decisive again in the closing stages, diving to save an effort from Gerard Pique shortly before Pelle but the outcome beyond doubt.