"I want to announce that my time with the Spanish national team has come to an end," he said in a statement.
"The hardest thing is knowing when to say goodbye, and after thinking about it, I think that my time with the national team has come to an end."
The 32-year-old was a key member of the Spanish sides that have won the past two European Championships in 2008 and 2012, as well as their first World Cup in 2010.
"It has been a glorious period with the Spanish team that started more than 11 years ago.
"I have formed part of an historical generation that has fulfilled the dreams of millions of fans, achieving something as unique as winning a World Cup and two European Championships in a row."
However, Alonso's final international tournament ended in huge disappointment as the holders crashed out of the World Cup in Brazil after just two games following defeats to the Netherlands and Chile in the group stage.
Alonso scored 16 goals in 114 international appearances and joins Xavi Hernandez in announcing his international retirement, heralding the end of an era for Spanish football.
"It is very difficult to improve on what he has done," added Spain coach Vicente del Bosque.
"He leaves a fantastic legacy along with his teammates. He has been a great professional."
Del Bosque will announce his squad for next months' friendly away to France and Spain's first Euro 2016 qualifier against Macedonia on Friday.