"Real Madrid C.F. and Tottenham Hotspur have reached an agreement for the transfer of player Luka Modric, who will be with the club for the next five seasons," the team said in a statement.
"Both clubs have also formalized a cooperation agreement," Real Madrid said.
The 26-year-old Modric has been keen to leave White Hart Lane since the end of last season.
But Real's attempts to sign him have been frustrated by Spurs chairman Daniel Levy's demands for a fee of around £40 million ($50 million euros, $63 million).
Spurs confirmed the transfer, subject to a medical, and said it had signed a partnership agreement for the two clubs to work together on players, coaching, best practices and commercial relationships.
"Luka has been a terrific player for us and, whilst we preferred not to part with him, we are pleased that it is to Real Madrid, a club with which we now look forward to sharing a long and productive partnership," Levy said.
Real Madrid president Florentino Perez welcomed the deal in a statement on the London club's site.
"We are delighted to welcome Luka and look forward to working closely with Tottenham in the coming years," he said.
The Spanish club said it expected him to play a key role.
"Real Madrid has signed a very talented and creative playmaker for the midfield," they said.
"An attacking player capable of assisting his teammates and delivering with great judgement, added to which he has a great capacity for work and sacrifice for the sake of the team," Real Madrid said.
Luka made 160 appearances for Spurs, scoring 17 goals after joining from Dinamo Zagreb in the summer of 2008.