* Kaka becomes first signing of Perez's presidency
* Second biggest transfer fee ever
* Presentation expected at end of June
MADRID, June 9 (Reuters) - Real Madrid have signed Brazilian midfielder Kaka from AC Milan, the Primera Liga club said on their website (www.realmadrid.com) on Tuesday.
The 27-year-old international has agreed to a six-year contract to become the first player to join Madrid since Florentino Perez returned to the presidency this month.
Reports said the transfer fee was around 68 million Euro (about £58.6m), which would make it the second biggest ever after Zinedine Zidane joined Real from Juventus for around 73m Euro in 2001.
Kaka completed a routine medical earlier on Monday in Recife, where Brazil face Paraguay at home in a World Cup qualifier on Wednesday.
Kaka said he was leaving the Italians on good terms.
"Everything I've always done for Milan has been by mutual agreement, from the moment I arrived until my departure today," he told a news conference at the Brazil team hotel. "I'm leaving by the front door."
"I've won everything that I wanted as a player and this is a new motivation for me."
"I'm sure Real Madrid will build a competitive team which can start winning titles again."
The official unveiling in Madrid is likely to take place at the end of the month, after the Confederations Cup in South Africa.
"We are working on building a good team, an important team, and this has only just begun," Perez told radio station Onda Cero.
Milan thanked Kaka for his contribution.
"AC Milan thanks the man Kaka and the champion Kaka for his decisive contributions to so many victories obtained in the last six years," the Serie A club said in a statement.
"His loss on the field, though serious, can be filled. It will, however, be very difficult to fill the void left by Kaka the man."
Kaka has long been a target for Real Madrid since former president Ramon Calderon promised to sign him in his election campaign in 2006 but failed to deliver.
Calderon resigned in January paving the way for Perez to come back three years after he stood down, and he was returned unopposed to the post.
Perez has promised to deliver a "spectacular sporting project" built around the world's greatest players, and local media have spoken of a 300m-Euro war chest which will be used to finance a second 'Galactico era' at the Bernabeu.
Having lured the likes of Luis Figo, Zinedine Zidane and David Beckham to Madrid earlier in the decade, Perez's flagship first signing on his return was Kaka, a move seen as both a declaration of intent and a dig at his predecessor.
He has also spoken of interest in Manchester United's Cristiano Ronaldo, Bayern Munich's Franck Ribery, Liverpool's Xabi Alonso and Valencia duo David Villa and David Silva.
New coach Manuel Pellegrini is the man tasked with blending these talents into a team capable of challenging treble-winners Barcelona.
Kaka will not face much competition in midfield which was one of Madrid's weakest areas last season as they lacked flair players capable of opening up sides in big games.
His arrival will also cheer Madrid fans clamouring for a more entertaining brand of football, and who had often chanted "Where is Kaka?" at player presentations under Calderon over the last couple of years.
More Kaka from FourFourTwo: Kaka joins Madrid from Milan Shy-boy demeanour hides ambition Kaka leaves Milan as best friends Kaka's exit a fresh blow for Italian football Kaka: the factbox Money talks and Kaka walks as Silvo suffers austerity The former republic of Real Madrid