Kaka, the former world's most expensive player, has returned to AC Milan on a free transfer.
The 31-year-old has signed a two-year deal with his former club and has expressed his delighed at returning to Serie A, saying the move is a "dream".
The Brazilian revealed last week that he wanted to leave the Bernabeu after a four year spell in Spain, and was quickly granted his wish.
AC Milan vice-president Adriano Galliani moved quickly to persuade the 2007 Ballon d'Or winner to return to Serie A.
A statement by Milan read: "Adriano Galliani sealed the deal to bring Kaka back to Milan between 2.30 and 3.00 this morning.
"The player has been given a contract ending on 30 June 2015."
Kaka was an isolated figure during the three-year tenure of Jose Mourinho at Real Madrid, and the signing of Wales winger Gareth Bale from Tottenham for a world-record £85m would have pushed the Brazilian further down the pecking order.
Galliani and Kaka landed in Milan just before lunchtime and the Brazil striker told the Milan Channel on his arrival: "Four years have passed and now I'm back.
"It's been two weeks that I thought if I could come back, a return to Milan would be ideal for me.
"In the last few days, I've been dreaming of hearing the fans sing my name in the San Siro again."
After leaving Sao Paolo as a teenager in 2003, Kaka won the Champions League and one Scudetto during his six years in Milan - also landing the prestigious Ballon d'Or award in 2007 - and lifted the Primera Division trophy, the Copa del Rey and the Spanish Supercup with Real.
On linking up with Italy forward and new team-mate Mario Balotelli, who made the move to Milan from Manchester City earlier this year, Kaka is confident they will team up well.
He added: "Mario is a great player and I want to do well with him. I hope I can do with him what I used to do with (Filippo) Pippo Inzaghi.
"I have a lot of desire to play and it's a very important year for me due to the World Cup, but right now I just want to do well for Milan, my team.
"I was very sad to leave this team and now it's great to be back. I'm very happy."
Galliani was delighted with the deal and believes Kaka will attract some long-lost fans back to the San Siro.
He told acmilan.com: "It was around 2.30 last night when the deal was done.
"Now I hope Kaka's orphans, the 12,000 or 15,000 fans that stopped coming to the stadium when he left, will come back now that Kaka's returned.
"He really made a huge effort to come back and has shown real affection for the jersey."