The fee is a blow for Tottenham chairman Daniel Levy, who was holding out for a figure in the region of £35m-plus.
The two clubs have also agreed a new 'partnership' that, according to Spurs, will see them "working together in respect of players, coaching, best practices and commercial relationships."
That is likely to mean that Modric is only the latest player to move between the two sides.
Levy said: "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."
Real president Florentino Perez added: "The strong relationship and affinity between our two clubs has resulted in the cementing of a longer-term partnership and the successful transfer of Luka Modric.
"We are delighted to welcome Luka and look forward to working closely with Tottenham in the coming years."