First-half goals from Eduardo Vargas and Charles Aranguiz were enough to give Chile a deserved win, which spells the end of Spain's defence of their title.
With Holland's win over Australia earlier in the day, Chile's three points - which takes them onto six points with the Dutch after two games - means Spain cannot now progress into the knock-out stages.
A tactical masterpiece from Chile's Argentine coach Jorge Sampaoli laid the foundation for the South Americans to humble their more-glamorous European opponents.
It is not the first time the reigning world champions have failed to make the knock-out rounds - Italy suffered that indignity in 2010 and so did France in 2002 - but never before has it happened after the first two games.
The 5-1 hiding handed out by Holland in the opening match was still reverberating for Spain, and the pattern of that nightmare second half of last Friday night continued in the same agonising vein.
Vincente del Bosque's side appeared frozen into inaction, and it did not help that they were playing a Chile side whose spirit was stoked by tens of thousands of fans bouncing off the walls of the Maracana - in some cases literally as thousands without tickets remained outside the stadiums with around 200 bursting through a security cordon prior to kick-off.
From the start, Chile - who have looked hugely impressive in the last couple of years, not least in a 2-0 win over England at Wembley in November - were fired up for this fray.
They served noticed of their threat when Gonzalo Jara, of Nottingham Forest, headed over from a good position - and held his head afterwards too: he knew it was a gilt-edged chance.
Spain knew they had to win and Claudio Bravo in the Chile goal stood in Xabi Alonso's way when the Real Madrid midfielder pounced on Andres Iniesta's deflected pass with only the keeper to beat.
He looked certain to score but Bravo stopped it with one hand at close range, and Alonso's next involvement was to lose the ball in the move which saw Chile go ahead.
Alexis Sanchez snapped up possession and played in Charles Aranguiz who picked out Vargas with a brilliant centre. The Valencia forward kept his head while Spain were losing theirs and neatly sidestepped Iker Casillas before sliding it home.
Alonso attempted to make amends but blasted high and wide from Diego Costa's lay-off, before the naturalised Brazilian striker scuffed a shot into the turf and side-netting as Spain's frustrations increased.
Two minutes before half-time and Spain's looming crisis became a fully-fledged disaster.
Casillas, heavily criticised after the Holland debacle and fortunate to keep his place, did himself no favours with a fairly pathetic double-handed fist at Sanchez's gentle free-kick and the ball dropped to Aranguiz who controlled it and then toe-poked back past the sorry keeper to make it 2-0.
Another bad miss from Costa, who was mercilessly taunted by the Chile fans, was followed by Jordi Alba spraying his shot wide as desperation set in for Spain in the second half.
Chile then turned rather wasteful, failing to kill off the game completely with Vargas shooting straight at Casillas, Mauricio Isla scooping over at full-stretch and Sanchez dallying too long when in space.
Del Bosque sent on Fernando Torres and Santi Cazorla to try a last-ditch rescue attempt and the Arsenal midfielder came close to scoring, denied by a sprawling save low to his right by Bravo with 10 minutes left.
Bravo was bravura to the last with more top-class saves, notably from Cazorla's free-kick.
Spain looked like broken men. After the 2010 triumph sandwiched by two European Championship wins - their world has come crashing down.