Luka Modric has finalised his switch to Real Madrid from Tottenham Hotspur after passing a medical with the Spanish club and signing a five-year contract.