Chile’s Eduardo Vargas, right, scores past Spain goalkeeper Iker Casillas, center, and Spain’s Sergio Ramos in their FIFA World Cup Group B match at the Maracana in Rio de Janeiro, Brazil, on Wednesday.

Photo: EPA

One of the greatest dynasties in modern soccer came to a shattering end when reigning champions Spain lost 2-0 to Chile on Wednesday and crashed out of the World Cup with their glory days consigned to the history books.

On the day when Spanish King Juan Carlos signed his abdication papers, the nation’s soccer players were forced off their throne as first-half goals from Eduardo Vargas and Charles Aranguiz earned Chile a stunning victory in front of thousands of their ecstatic fans in a 74,000 crowd at the Maracana in Rio de Janeiro.

The South Americans, who attacked the holders from the first whistle, reached the round-of-16 along with the Netherlands and confirmed the pre-World Cup talk that they could advance deep into the tournament with a disciplined display against a tired-looking Spain who went out along with Australia.

The Netherlands, who beat Spain 5-1 on Friday last week, and Chile each have six points and they meet in Sao Paulo, Brazil, on Monday next week to decide the group winners. Spain face Australia in Curitiba bidding to avoid finishing bottom of Group B.

Chile swept into the lead after 20 minutes following a counterattack on the right which set up Aranguiz to provide the cross for Vargas, who danced around goalkeeper Iker Casillas before firing home.

Casillas, who had a poor game against the Netherlands, was at fault again for the second goal, punching an Alexis Sanchez free-kick straight back to Aranguiz, who placed the ball past the goalkeeper with a spinning shot two minutes before halftime.

Spain had their chances, notably through Sergio Ramos and Jordi Alba late in the game, and one opportunity for Sergio Busquets early in the second half might have changed the game, but he fluffed his kick to howls of derision from the Chile fans and Spain never looked like winning after that.

“We cannot complain we did not deserve to go out, they were better than us,” Spain coach Vicente del Bosque told reporters. “The team showed character, we pressed forward, but we had little luck in front of goal. We were certainly inferior to our rivals here at the finals. It is not the moment to think about the future. Little by little we will make the necessary assessments.”

Chile midfielder Arturo Vidal, who had a fine match, was unsurprisingly in upbeat mood.

“We showed we are at a very good level,” Vidal said. “We didn’t come for a holiday, we came to fight for the championship.”

Spain became the third champions in the past four World Cups to be eliminated at the first hurdle and their departure will almost certainly end the long international careers of greats Xavi, Casillas and Xabi Alonso.

Xavi, for so long the fulcrum of the side who won the Euro 2008 and Euro 2012, and their first World Cup in South Africa four years ago, did not even make the starting lineup.

His long-term partner, Andres Iniesta, tried to do what he has always done best, but made little impression against an inspired Chile.

Chile, who had never beaten Spain in 10 previous meetings, looked sharp and confident from the start, and even faster and more fluid in the second half.

Playing with the masterful Vidal in the hole behind Alexis Sanchez and Vargas, they controlled the play and he pulled the strings as Chile showed the old masters how it should be done.

With more composure in front of goal following a series of rapid-fire counterattacks, they could easily have scored more, confirming the suspicion first raised about Spain at the Maracana a year ago when Brazil crushed them 3-0 in the FIFA Confederations Cup final.