Ramos had been courted by Manchester United during a standoff in negotiations between his representatives and Madrid president Florentino Perez over the Spanish international’s salary with his previous deal set to expire in 2017.
However, the club said in a statement he will remain “tied to the club for the next five seasons,” AFP reported.
According to Spanish media reports, Ramos will earn up to 10 million euros ($11.1 million, £7.1 million) a season.
United and Madrid have been locked in transfer talks all summer with Real still hopeful of landing Ramos’s international teammate David de Gea before the transfer window closes at the end of the month.
Ramos is now Madrid’s longest serving player having signed from Sevilla 10 years ago as a 19-year-old and will be club captain for the first time this season after Iker Casillas’s 18-year career at the Bernabeu came to an end when he joined Porto last month.
Despite holding an unwanted record as the Madrid player to have seen most red cards in the history of the club with a staggering 19 dismissals, Ramos is a hero amongst the Real support and is most fondly remembered for scoring the goal that saved Los Blancos from losing the 2014 Champions League final to local rivals Atletico Madrid.
His stoppage time header forced the game into extra-time where the white half of Madrid went onto dominate and run out 4-1 winners to complete his own personal repertoire of honors, which also includes three La Liga titles and two Copa del Reys as well as the World Cup and two European Championships at international level with Spain.
By committing to stay at the Bernabeu, Ramos has offered a huge lift to a Real side in need of a confidence boost ahead of the kick-off to the La Liga campaign next weekend.
Ramos was among a host of high-profile first-team players also including Cristiano Ronaldo and James Rodriguez who showed their discontent at the sacking of Carlo Ancelotti in May.
The appointment of Rafael Benitez as Ancelotti’s successor was met with scepticism by the vast majority of the club’s fans and Perez has unusually decided against the lavish signing of a “galactico” this summer, instead settling for a deeper and younger squad.
However, without the injured Ronaldo, Benitez’s men have struggled in pre-season, failing to score in four of their seven friendlies so far.
Madrid begin their league campaign away to newly promoted Sporting Gijon on August 23.