Real Madrid and Everton have reached agreement on the sale of Thomas Gravesen, with the Dane set to move to the Bernabeu subject to him passing a medical.

“Real Madrid have reached an agreement for the transfer of Thomas Gravesen to The White club (Real),” said a Real statement on www.realmadrid.com.

“Gravesen will play for Real Madrid in what remains of this season and three more.”

The Dane had already agreed personal terms with Real, negotiated because he was out of contract at Goodison Park in the summer – and therefore free to talk to clubs during the January transfer window.

Agent John Sivabaek said: “Thomas is very excited, but sad because he had five fantastic years at Everton.”

The 28-year-old was out of contract in the summer and Sivabaek added: “He was very happy at Everton, but when Real Madrid want you, you cannot say no.”

High flying Everton were desperate to keep Gravesen, but they have admitted defeat and have now accepted a fee of £2.5m million for him, rather than letting him go for nothing at the end of the season.

Gravesen will now have a stringent medical in Madrid before putting pen-to-paper on a three-and-half-year deal.