Modric has become a fundamental part of the Real side since his arrival from Tottenham Hotspur in 2012.
Modric, 31, has become a fundamental part of the Real side, winning two Champions League titles, since his arrival from Tottenham Hotspur in 2012.
"My wish is to retire at Real Madrid and with this renewal I am closer to that goal," Modric said on Wednesday.
"I want to thank the club and the president for having so much confidence in me.
"I am going to continue giving everything I have, working hard and I hope to have more success in front of me."
Modric's quality on the ball and work rate has converted the Croatian into a fans' favourite at the Santiago Bernabeu in recent years.
However, he had to overcome a difficult and trophyless first season in the Spanish capital before he established himself as a regular in the team.
"I had confidence in myself from the start. I never doubted my qualities," he added.
"I knew that sooner or later I way going to succeed here with the work I put into every match, every training session."
And the former Tottenham Hotspur star insisted mental toughness is needed as much as ability to succeed at the richest club in the world.
"To play at Real Madrid it is not enough to have football quality. It is very important to be strong mentality and never give up."
Modric is currently sidelined by a knee injury, which is expected to keep him out until next month.
Yet, he refused to confirm he would be fit in time for the Madrid derby away to Atletico on November 19.
"I feel good, every day I feel a little bit better," he added.
"I am working hard to return as quickly as possible, but I can't say when I will return."