Real Madrid midfielder Xabi Alonso has announced he will retire from football at the end of the World Cup.

Alonso, 32, has been an integral part of Spain's success in recent years, winning Euro 2008 and Euro 2012 as well as the 2010 World Cup in South Africa.

Alonso won his 112th cap for Spain in the 2-0 defeat to Chile, a result that made La Roja the first team to be eliminated from the tournament.

Download the new Independent Premium app Sharing the full story, not just the headlines

He was hauled off at half-time in that game after a poor first half, which included him losing the ball in the build up to Chile's opener.

The former Liverpool man has scored Spain's only goal of the tournament so far, from the penalty spot in the 5-1 humiliation at the hands of the Netherlands.

Shape Created with Sketch. Spain 0 Chile 2 player ratings Show all 22 left Created with Sketch. right Created with Sketch. Shape Created with Sketch. Spain 0 Chile 2 player ratings 1/22 Spain: Iker Casillas 5/10 Another nightmare showing from the Spanish captain. Looked frail at set-pieces and was to blame for Chile’s second. Is this his last major tournament with with his country? Getty images 2/22 Cesar Azpilicueta 6 Did very little after a surprise call-up to the Spanish starting eleven. Gave possession away far too cheaply and looked out of place. Getty images 3/22 Sergio Ramos 6 Constantly striving to get forward, as well as defending well, Ramos at least showed an intent to halter Spain’s slide. Getty images 4/22 Javi Martinez 6 While not doing too much wrong, Martinez failed to excel when Spain needed a leader. Getty images 5/22 Jordi Alba 6 Ran the line reasonably well but was left wanting defensively on far too many occasions. Had a difficult afternoon trying to contain Alexis Sanchez. Getty images 6/22 Xabi Alonso 5 The former Liverpool man had an awful first half, surrendering possession far too easily. A number of wild shots, which blazed over the bar, summed up his country’s night. Getty images 7/22 Sergio Busquets 5 The Barcelona midfielder will ultimately be remembered for that horrendous miss in the second half. Offered little else. Getty images 8/22 Pedro 6 Had a quiet evening when much was required from him if Spain were to get back into the game. Will be bitterly disappointed with his distribution tonight. Getty images 9/22 David Silva 6 Went missing for large periods of the game but did improve towards the end of his shift. Could have made the difference if luck went his way. Getty images 10/22 Andres Iniesta 6 While his undeniable class was evident throughout, Iniesta’s passing didn’t penetrate the Chilean defence nearly enough. An ineffective evening. Getty images 11/22 Diego Costa 5 A poor performance from a striker who looks severely out of place in the Spanish set-up. His game, built on power and pace, doesn’t match up with the philosophy in which he has been expected to embrace. Getty images 12/22 Chile: Claudio Bravo 8 While consciously adding an air of the spectacular to his saves, Bravo made a range of excellent stops to keep Spain out. A fine display from an exciting goalkeeper. Bravo indeed. 13/22 Mauricio Isla 7 Racing forwards at every opportunity, Chile’s right-back has made something of a name for himself tonight. Chileans, however, won’t be surprised by his display tonight. 14/22 Eugenio Mena 7 Like his counterpart on the other side of Chile’s defence, Isla, the Santos left-back offered an attacking threat as well as defensive solidity. 15/22 Gonzalo Jara 7 A rock at the heart of Chile’s backline, the former Nottingham Forest defender earned his stripes by keeping the likes of Diego Costa at bay. 16/22 Gary Medel 7 Playing in his more familiar position at centre-back, despite being used in midfield for Cardiff City, Medal wore his heart on his sleeve and made a couple of essential interceptions. 17/22 Francisco Silva 7 Offering a springboard for Chile to leap into attack from, Silva often stayed back and manned the fort. Giving the players around him the freedom to run at the Spanish defence, he played a vital role this evening. 18/22 Charles Aranguiz 8 Scoring Chile’s second and proving to be a constant thorn in Spain’s side, this was a marvellous performance defined by his electric pace. A true shame he couldn’t stay on the pitch. 19/22 Marcelo Diaz 7 The FC Basel man was an essential cog in Chile’s well-oiled, and well drilled, midfield. Kept his teammates grounded when they may have become over exuberant. 20/22 Arturo Vidal 8 An impressive performance from Juventus’ 27-year-old star man. Representing all that Chile stand for, Vidal held up the ball superbly and wasn’t afraid to run with it. 21/22 Alexis Sanchez 9 A menace throughout, the occasionally maligned Barcelona playmaker was at the top of his game today. Unlucky not to score from one of his many opportunities. 22/22 Eduardo Vargas 8 After putting his side ahead early into the game, Vargas then became more defensively-minded and did an important job in holding the ball up until the cavalry could catch up. An effective display. 1/22 Spain: Iker Casillas 5/10 Another nightmare showing from the Spanish captain. Looked frail at set-pieces and was to blame for Chile’s second. Is this his last major tournament with with his country? Getty images 2/22 Cesar Azpilicueta 6 Did very little after a surprise call-up to the Spanish starting eleven. Gave possession away far too cheaply and looked out of place. Getty images 3/22 Sergio Ramos 6 Constantly striving to get forward, as well as defending well, Ramos at least showed an intent to halter Spain’s slide. Getty images 4/22 Javi Martinez 6 While not doing too much wrong, Martinez failed to excel when Spain needed a leader. Getty images 5/22 Jordi Alba 6 Ran the line reasonably well but was left wanting defensively on far too many occasions. Had a difficult afternoon trying to contain Alexis Sanchez. Getty images 6/22 Xabi Alonso 5 The former Liverpool man had an awful first half, surrendering possession far too easily. A number of wild shots, which blazed over the bar, summed up his country’s night. Getty images 7/22 Sergio Busquets 5 The Barcelona midfielder will ultimately be remembered for that horrendous miss in the second half. Offered little else. Getty images 8/22 Pedro 6 Had a quiet evening when much was required from him if Spain were to get back into the game. Will be bitterly disappointed with his distribution tonight. Getty images 9/22 David Silva 6 Went missing for large periods of the game but did improve towards the end of his shift. Could have made the difference if luck went his way. Getty images 10/22 Andres Iniesta 6 While his undeniable class was evident throughout, Iniesta’s passing didn’t penetrate the Chilean defence nearly enough. An ineffective evening. Getty images 11/22 Diego Costa 5 A poor performance from a striker who looks severely out of place in the Spanish set-up. His game, built on power and pace, doesn’t match up with the philosophy in which he has been expected to embrace. Getty images 12/22 Chile: Claudio Bravo 8 While consciously adding an air of the spectacular to his saves, Bravo made a range of excellent stops to keep Spain out. A fine display from an exciting goalkeeper. Bravo indeed. 13/22 Mauricio Isla 7 Racing forwards at every opportunity, Chile’s right-back has made something of a name for himself tonight. Chileans, however, won’t be surprised by his display tonight. 14/22 Eugenio Mena 7 Like his counterpart on the other side of Chile’s defence, Isla, the Santos left-back offered an attacking threat as well as defensive solidity. 15/22 Gonzalo Jara 7 A rock at the heart of Chile’s backline, the former Nottingham Forest defender earned his stripes by keeping the likes of Diego Costa at bay. 16/22 Gary Medel 7 Playing in his more familiar position at centre-back, despite being used in midfield for Cardiff City, Medal wore his heart on his sleeve and made a couple of essential interceptions. 17/22 Francisco Silva 7 Offering a springboard for Chile to leap into attack from, Silva often stayed back and manned the fort. Giving the players around him the freedom to run at the Spanish defence, he played a vital role this evening. 18/22 Charles Aranguiz 8 Scoring Chile’s second and proving to be a constant thorn in Spain’s side, this was a marvellous performance defined by his electric pace. A true shame he couldn’t stay on the pitch. 19/22 Marcelo Diaz 7 The FC Basel man was an essential cog in Chile’s well-oiled, and well drilled, midfield. Kept his teammates grounded when they may have become over exuberant. 20/22 Arturo Vidal 8 An impressive performance from Juventus’ 27-year-old star man. Representing all that Chile stand for, Vidal held up the ball superbly and wasn’t afraid to run with it. 21/22 Alexis Sanchez 9 A menace throughout, the occasionally maligned Barcelona playmaker was at the top of his game today. Unlucky not to score from one of his many opportunities. 22/22 Eduardo Vargas 8 After putting his side ahead early into the game, Vargas then became more defensively-minded and did an important job in holding the ball up until the cavalry could catch up. An effective display.

Uncertainty also surrounds the futures of fellow midfielder Xavi and goalkeeper Iker Casillas, who have both had terrible tournaments.

However, one man who will not be moving on is the coach Vicente del Bosque, who has been backed by the Spanish football federation despite the poor performance of his team.

Spanish newspaper Marca reports that Alonso made the decision before the start of the tournament in Brazil.

The best league in the world is back. Join The Independent for an online event, as our panel discusses the most uncertain start to a season in Premier League history. Click here to find out more and book your free ticket today.