The defender has been linked with the Blancos for months and, on Wednesday, they finally came to an agreement with Porto for a summer move
Real Madrid have confirmed the €31.5 million signing of Porto right-back Danilo, who has signed a contract until 2021.
The Brazilian, 23, has been rumoured to be on the European champions' radar for months and Danilo confessed a week ago he was proud of being linked with Carlo Ancelotti's men.
And, on Wednesday at midnight, the two clubs announced the defender would be leaving the Dragao this summer to sign a six-year contract at the Santiago Bernabeu.
"Porto hereby informs the market that it has reached an agreement with Real Madrid for the permanent transfer of Danilo for the value of €31.5m," the Portuguese club said in a statement to the stock market.
Real Madrid confirmed in their statement that Danilo would be joining the Spanish heavyweights - who reportedly saw off competition from rivals Barcelona for Danilo's signature - until June 30, 2021.
Danilo has been ever-present in Julen Lopetegui's side in his fourth season at the club, bagging four goals and four assists as Porto have romped to the last eight of the Champions League.
They face Scudetto holders Juventus for a spot in the semi-finals, while Porto are three points adrift of Primeira Liga table-toppers Benfica with eight games to go.