The 23-year-old, who has won two league titles with the Portuguese giants and has 11 Brazil caps, will commit to the Santiago Bernabeu outfit until June 30, 2021.
The fee for Danilo is 31.5 million euros (£23 million), Porto said in a statement to the Portuguese stock exchange.
Danilo started his career at Brazilian club America before joining Santos and then moving to Porto in January 2012 where he has won two Portuguese league titles.
Danilo, who won a silver medal at the 2012 London Olympics, has become a regular for Brazil since Dunga took over as manager after last year’s World Cup.
Danilo has also helped Julen Lopetegui’s Porto side reach the Champions League quarter-finals where they will play Bayern Munich next month.
WHAT DID PORTO SAY?
Coach Lopetegui: “This year he wanted to learn to improve in all aspects of his game – tactically, physically and in his concentration. Danilo has helped us improve and the team has grown collectively. He has progressed very quickly because he understood what we asked and, like the rest of the team, he wanted to grow and grow at Porto despite being a young player. We already knew the strategy of the club and the coach has to adapt to what they give you. This will allows us to work with younger players that motivates us to polish and perfect them.”
THE VIEW FROM MADRID
Jorge Ordas, Eurosport Spain: “Danilo’s transfer has been a surprise. Not exactly the transfer itself, because everybody expected it, but for the announcement in April. There is no doubt Danilo is a very good player, he has been able to send Dani Alves to the bench for the Brazilian national team, but time will tell if 31 million euros for him is a good deal (when Pepe signed for Real Madrid from Porto people didn’t believe he was worth 30 million and finally it has come to be seen as a successful transfer).
“There is only one big doubt about this transfer: how could Danilo affect Dani Carvajal? Carvajal is young, has been formed in Real Madrid, people like him and his growth as an important player is significant. Carlo Ancelotti (or the next coach) will have a difficult decision when selecting the right-back next season…”
By PA Sport