Italy dream over after waking up too late
The Slovaks, the only newcomers in the 32-team field, held on desperately at the very end as Italy failed to force the draw that would have kept them in the tournament.
Instead, the World Cup debutants reached the last 16 after coming second in Group F behind Paraguay, who drew 0-0 with New Zealand, while the world champions go home in last place.
It was the first time Italy had conceded three goals in a match at a World Cup tournament since they lost 4-1 to Brazil in the 1970 final in Mexico.
"The whole of Slovakia is happy, it's a fantastic day for us. After the birth of my son, it's the second best day of my life," coach Vladimir Weiss said.
But for an off target effort right at the end and an earlier offside decision, Italy might well have staged a stunning comeback after being 2-0 down with less than 10 minutes left.
Robert Vittek set Slovakia on their way to an unexpected triumph with the first two strikes but the real drama was reserved for the closing stages as three more goals kept the match in the balance until the dying moments.
Italy, who had drawn their two previous group matches, brought the score back to 2-1 in the 81st minute through Antonio Di Natale and had the ball in the net again two minutes later, only for Fabio Quagliarella to be flagged marginally offside as he swept the ball home from close range.
The world champions still looked odds on to score the all-important equaliser but got caught by a sucker punch as substitute Kamil Kopunek ran onto a quick throw-in and restored Slovakia's two goal advantage in the 89th minute.
A sublime 20 metre chip from Italy striker Quagliarella three minutes into stoppage time sailed in under the bar to add another twist to a rapidly-evolving saga.
But hopes of a dramatic conclusion, as the Slovaks repeatedly tested the patience of referee Howard Webb with time-wasting tactics, were dashed when Simone Pepe missed at the back post with what was virtually the last kick of the game.
Vittek had given Slovakia the lead in the 25th minute after a cautious beginning in front of a 53,412 crowd, turning onto a clever through pass from Juraj Kucka and hitting the ball wide of goalkeeper Federico Marchetti.
A second goal in the 73rd minute was just reward for a workmanlike performance by the underrated Slovaks, as Marek Hamsik's corner was blocked but he played the rebound into Vittek who tucked the ball away at the near post.
"We didn't expect such domination. We played with our hearts and that's what decided the match today," said Vittek.
The holders sparked into life belatedly but, as the crowd edged forward in their seats spellbound by the three quick goals, Italy were out of time and the World Cup.
"I take all responsibility, all responsibility for what happened," said coach Marcello Lippi.
"If a team turns up at such an important game with terror in their heart and their legs and is unable to express its ability it's because the coach didn't train the team as he should."