Hakimi has signed a five-year contract at the San Siro and will link up with the Nerazzurri from next season.
Hakimi spent the last two seasons on loan in the Bundesliga with Borussia Dortmund from Real Madrid but his future in the Spanish capital was far from guaranteed.
Hakimi made 73 appearances in all competitions for Dortmund and scored 12 goals, winning the 2019 German Super Cup.
The 21-year-old Moroccan international arrived in Milan earlier this week for a medical and has now completed a switch to Antonio Conte’s side.
"Real Madrid and Inter Milan have agreed the transfer of Achraf Hakimi," a statement from Real Madrid said.
"The club want to thank Achraf for all these years of dedication, professionalism and exemplary behaviour since he arrived at our academy in 2006 and wish him luck in this new stage of his career."
Hakimi made 17 competitive appearances during his time as a Real Madrid player and earned a UEFA Champions League winners’ medal after Los Blancos defeated Liverpool 3-1 in the 2018 final.
Confirming the transfer on their official website, Inter wrote: "Achraf Hakimi is officially an Inter player.”
With the ability to operate from the right wing-back role, Hakimi will be a perfect fit for Conte’s favoured 3-5-2 formation.