The 31-year-old Portuguese’s last deal was set to end in June 2018 but he will now remain with the Spanish giants until June 2021.
He added that the new contract would not be the last deal he signs.
“What I most want is to continue enjoying the years I have left to play,” said the former Manchester United player. “I still have 10 years.”
Real Madrid president Florentino Perez added: “We want to be together for many years to come.”
Ronaldo has scored 371 goals since joining Real from United in 2009 and has helped the club win the Champions League twice and La Liga once.
While he wants to end his career at the Bernabeu, he admitted: “No-one knows what the future holds.”
He added: “I’m going to be here for another five years, but let it be known this will not be my last contract.
“I have said many times that I carry this club in my heart, it is part of me and it is a special time in my life.
“Of course I would like to end my career at this club. I want to be here for many years to come. I want to continue rewriting history at this club.”
It has been reported his weekly wage will remain at around £365,000.
Ronaldo helped Real cement their place at the top of the La Liga table by beating Leganes 3-0 on Sunday.
After the game, Real boss Zinedine Zidane described Ronaldo as “unique”.
NANLast modified on Tuesday, 08 November 2016