Selected for the first time in November 2006, the 32-year-old helped his country be crowned world champions in South Africa in 2010 and won two European Championship titles in 2008 and 2012.
"I leave proud and happy, bringing an end to a time full of emotions and memories, like of the figure of Luis Aragones, a maestro who will never be forgotten" he said in a message on social media.
"I lived and dreamed with a team that will forever be remembered.
"I've spent days and weeks considering this. The national team gave me everything and helped me grow as a player and a person."
Silva's announcement follows on from the international retirement of centre-back Gerard Pique last week.
Pique's former Barcelona teammate Andres Iniesta ended his time with Spain after this summer's disappointing World Cup finals campaign in Russia.