Porto fullback Danilo will become Real Madrid's most expensive defensive signing.
Danilo will move to Real Madrid this summer.
Madrid paid 31.5 million plus 5 million more in add-ons (a total of 36.5).
Porto acquired 100 per cent of the player's rights in 2011 when they paid Santos 13 million. They also paid 4.8 per cent in commissions.
The game's most expensive defender is PSG defender David Luiz, who moved from Chelsea for £50 million.