The defender, who will join in the summer, is 21 years old and is a full worldwide with Brazil.
A statement released by Madrid on their official website read: "Eder Gabriel Militao is officially a new Real Madrid player, signing until 2025".
He has scored three goals and picked up two assists in 34 appearances for the Portuguese side, with his displays catching the eye of Madrid. Militao was named as the best defender in the competition for five consecutive matches.
New Avengers: Endgame Trailer Drops And Sets Up Epic Battle
It's almost time for the Avengers to assemble once more - and that means there's a new trailer to tease us with what's to come. Brie Larson's Captain Marvel , who will make her Avengers debut in Endgame , might just be the universe's saving grace.
Pixelbook begone? Google reportedly reduces in-house computer production
Perhaps that's why the company is reportedly reassigning some employees from the "Create" team to other units within it.
Well played Usman Khawaja: Major General Ghafoor trolls India after Australia thrashing
When he played, and even when he did not, MS Dhoni established how important he is, from behind the stumps and in front of it. They will rejoin their team-mates in mid-May, ahead of World Cup warmup matches against India and West Indies in the UK.
The Brazilian only joined Porto from Sao Paulo last summer for €4 million.
Militao, who can also play at right-back and has been capped once by Brazil, reinforces a Real defence that has often been diminished by injuries this season.
It has not even been a week since the Frenchman returned to the helm at Los Blancos, and already the club has secured the services of a centre-back who will join them at the end of the current season. It stands out for its speed, placement and ability to anticipate.
He has enjoyed considerable success in that role before and will be hoping to see Militao help to deliver more once welcomed into the Real fold.