Spain avoided becoming the third of European football's anciens regimes to be toppled at this World Cup and a potential clash with Brazil in the last 16 by overcoming Chile in a thrilling and highly tense encounter.
Despite going two goals up through David Villa and Andres Iniesta, and facing a side reduced to 10 men when Marco Estrada picked up a second caution by tripping Fernando Torres, they endured some nervy moments after Rodrigo Millar pulled a goal back.
But the game petered out as both sides realised that, with Switzerland struggling to overcome Honduras, they would go through together if the status quo was preserved. Chile now face Brazil in Pretoria on Tuesday afternoon, while Spain as group winners meet Portugal in Cape Town later that evening.
"I think we've overcome a very difficult time," the Spanish coach, Vicente del Bosque, said. "We were very disturbed emotionally by the defeat to Switzerland but we are more optimistic now and I'm sure that will be reflected on the pitch."
With Iniesta returning on the right after recovering from a thigh injury, Spain switched David Villa to the left and allowed Fernando Torres to lead the line. It was the first time in the tournament that Del Bosque was able to play his first-choice front three and suddenly the old Spain, the team that had lost only once in 49 matches before the World Cup, were back. And Chile were in the firing line.
Two chances were created in the opening five minutes, both for Torres. A header on tip-toes went over the bar; a shot from Joan Capdevila's punt forward was blocked by Gonzalo Jara on the stretch. But Chile did not flinch and Iker Casillas had to leap high from a standing start to paw away Alexis Sanchez's lob.
It was a fast, free-flowing game and hot-tempered with it. Gary Medel picked up a yellow card which will rule him out of the Brazil game after a foul on Sergio Busquets. Waldo Ponce was lucky to see only yellow when he pushed at Torres's shins with his studs in full view of the referee, Marco Rodrguez, in a foul that carried echoes of David Beckham's sending-off against Argentina in 1998. And Marco Estrada was cautioned for sliding through Busquets. Worse was to come.
At this stage Chile's quick one-twos and fast breaks were troubling Spain but halfway through the first half another rush of blood to the head this time from the goalkeeper, Claudio Bravo led to Spain taking the lead. Bravo charged out of his area to stop Torres running on to Xabi Alonso's pass but his sliding block fell only to Villa who composure personified looked up before curling a shot first time from the touchline into the unguarded net.
But Chile, urged on by their raucous fans, kept pushing forward. One moment summed up the thrilling nature of the first half as Piqu held his head in his hands after nodding Xavi's corner over the bar only to realise that Chile had launched another thrilling counterattack. He then had to sprint the entire length of the pitch to block Jean Beausejour's shot as he was clear on Casillas.
Both sides continued to press and it appeared Spain should have had a penalty when Torres was shoved by Vidal. A minute later Torres went down again outside the penalty box but play continued and Villa played in Iniesta who side-footed neatly home from 12 yards. As the Spanish ran to celebrate, the referee showed Estrada a second yellow for a trip on Torres in the build-up which looked accidental at most. However, Ponce probably should have seen red for stamping on Alonso.
Chile's coach, Marcelo Bielsa, defended his team's aggressiveness, claiming: "We are not a team that plays tough but we do try to get the ball back quickly. But Spain are different. They move the ball very well and we were simply too late to get it. But I don't think we used force excessively. We didn't have bad intentions."
And nor, really, did both teams once Chile pulled it back to 2-1 through Millar's deflected shot early in the second half. Shortly afterwards Torres, who Del Bosque later confirmed had a slight muscle strain, was replaced by Cesc Fbregas and Spain switched to a more conservative 4-4-1-1. But Chile's defence kept hassling and chasing, while Bielsa kept two men up front to discourage Spain from throwing their full-backs forward.
It worked. The last 10 minutes was played at walking pace as Spain sent passes along their back line and Chile sat off. Understandably there were a few whistles at this non-aggression pact. But both teams are through to the last 16 and the tournament is better for it.