Uruguay scored a dramatic late winner to knock four-time winners Italy out of the World Cup in a match involving another controversial Luis Suarez 'biting' incident.
Liverpool striker Suarez appeared to bite Juventus defender Giorgio Chiellini one minute before Diego Godin scored Uruguay's winner.
Earlier in the game, Italy midfielder Claudio Marchisio was sent off for a studs-up challenge on Egidio Arevalo.
Uruguay will now play either Colombia or Ivory Coast at the Maracana on Saturday in the last 16 of the World Cup, but controversy is likely to rumble on.
Italy left the field furious at the manner of their defeat but having to come to terms with a second World Cup in which they have failed to get beyond the group stages - the first time that has happened to the Azzurri since 1966.
It means they have failed to progress to the knock-out stages since winning the World Cup for a fourth time in 2006, and much of the focus will now turn on Italian coach Cesare Prandelli, who said before the game it was "the most important match of my professional career".
This was a tense and turgid contest that was bad-tempered both on the field and the touchline.
On a number of occasions the officials had to step between the two benches, the referee's whistle interrupted play constantly and the players spent as much time on the turf as they did running with the ball at their feet.
Key facts
Italy have won just one of their last seven World Cup games, drawing three and losing three.
It is the first time since 1970 Italy have failed to score in two consecutive World Cup games.
This is the sixth win for South American sides in eight matches with European teams in this World Cup.
That suited Italy. The Azzuri, in a 3-5-2 formation, lacked cohesion, tempo and sustained threat. But if their system was designed to disrupt Uruguay's attacking flow, it was working.
Andrea Pirlo forced Uruguay goalkeeper Fernando Muslera to push his swerving free-kick over the bar, while striker Ciro Immobile shot wildly over.
Cavani wanted a penalty after 50 minutes, having gone down under the challenge of Andrea Barzagli, but the referee waved his claims away.
The Mexican official would, however, change the game moments later when he showed Marchisio a red card after the Juve midfielder challenged Arevalo for a loose ball near the centre circle.
Marchisio's studs were raised and made contact with the Uruguay midfielder close to his knee, leaving the referee with no option but to show him the red card.

Uruguay sensed their opportunity. Suarez almost broke the deadlock, striking a low shot with the outside of his boot that Buffon turned away with his upper arm.
More controversy was to come, however, as Suarez and Chiellini clashed in the penalty area with nine minutes remaining.
The Italy defender immediately complained to the referee that he had been bitten and attempted to show the official the mark.
With Italy's players still complaining to the referee, Uruguay won a corner. Suarez delivered a perfect cross and Godin rose highest, the ball going in off his back.
Italy threw everything at Uruguay to rescue the game, including keeper Buffon striding forward for a late corner, but Oscar Tabarez's side held firm.
This game is unlikely to be remembered for football, however. The spotlight will, once again, fall on Suarez.