The defender played 671 games for Real Madrid and will be remembered as one of the club's greatest ever players, having won five La Liga titles and four Champions Leagues.
The 35-year-old, who struggled for fitness and form last season, was unable to agree an extension to his contract and will become a free agent on July 1.
Ramos and Real Madrid president Florentino Perez delivered short speeches in a presentation room at the club's training ground, with Ramos' family in the audience.
"The moment has come, one of the most difficult in my life, because you are never ready to leave Real Madrid," Ramos said.