Militao, who had been linked with Manchester United earlier this season, has agreed a long-term six-year contract with Los Blancos that promises to keep him at the Bernabeu until 2025.
Real have not disclosed the transfer fee, but it was previously rumoured that they would have to trigger the player's buyout clause. According to Marca, getting the deal done early was crucial as the estimated €50m clause was set to increase to €75m after 15th July.
The versatile 21-year-old only joined Porto from Sao Paulo last summer, but has impressed considerably in his debut season in Europe. The Brazilian club are also expected to receive a financial windfall via a sell-on clause.
Militao has played virtually every game for Porto so far in 2018/19 after making his Liga Primeira debut while still only 20 back in September. He has also played regularly in the Champions League, helping Porto reach the quarter finals for the first time since 2015.
The player could yet the be the start of a summer splurge at Real after Zinedine Zidane's unexpected return to the club this week. Rumour has it that Zidane has been promised an expensive squad overhaul after what has been a bitterly disappointing campaign for the club.