The 25-year-old was rushed to the Bernabeu after undergoing a medical following his arrival in the city late in the afternoon.
The player's presentation was delayed because of arguments between Real and Lyon over who would pay the 1.3 million euros in compensation to his previous clubs Bamako, OFI Crete and Vitesse Arnhem for their role in the player's development.
Radio Marca reported that the deal finally went through after Real, Lyon and the player agreed to share the payments between them.
"It was a difficult signing, but Fabio Capello had expressly asked for the player," said Real president Ramon Calderon. "We needed him to strengthen our midfield and Capello considered him vital in order to consolidate this new project.
"He an intelligent footballer who knows how to defend and also how to attack -- a complete player."
The holding midfielder could make his debut in Wednesday's pre-season match against Anderlecht in the Bernabeu Trophy.
Neither club disclosed fee details but Spanish media say the nine-times European champions have agreed to pay Lyon some 26 million euros, making Diarra the most expensive close-season signing in the Primera Liga.
Diarra is the fourth player to join Real since Ramon Calderon was elected president last month and brings the club's total close-season spending to over 60 million euros.
Real have also signed Italy's World Cup-winning captain Fabio Cannavaro and Brazil midfielder Emerson from Juventus and Dutch striker Ruud van Nistelrooy from Manchester United.
A key figure in the Lyon midfield, Diarra joined the French side from Vitesse in 2002 and has won the last four Ligue 1 titles with the club.
He will team up with Emerson to form what Real hope will be a watertight partnership in central midfield, a problem area since French midfielder Claude Makelele left for Chelsea in 2003.
More from rediff