Keylor Navas has signed for Paris Saint-Germain on a permanent deal, while Alphonse Areola has gone the other way on loan.
The 32-year-old goalkeeper has signed for an estimated €15m (£13.6m) fee on a four-year deal, after agreeing personal terms, and is set to become the first Costa Rican to play for the French champions.
Navas spent five years in Madrid, playing more than 100 times for Real and winning 11 trophies including three successive Champions League titles, and boss Zinedine Zidane admitted last month he did not want to lose him.
Navas said: "I'm really excited to sign for Paris Saint-Germain.
"I'm coming to France with high hopes - it is a very prestigious club and I am keen to be part of the adventure.
"I will do everything I can to help PSG win new titles, bringing all my experience and professionalism, and will also try to win the hearts of the Parisian fans, famous throughout Europe for their passion."
Areola - who played 75 times in goal for PSG - has moved to Madrid in a separate deal on a season-long loan with no obligation to buy, and remains contracted to the Parisian side until 2023.
The France international, 26, returns to La Liga after spending one season on loan at Villarreal in 2015/16 and will challenge Thibaut Courtois for the goalkeeping jersey at Real.
PSG let Gianluigi Buffon, who played 25 times last season in all competitions, rejoin Juventus this summer but have signed 19-year-old Marcin Bulka from Chelsea and Sergio Rico from Sevilla on a season-long loan with an option to buy.
Bulka, who kept a clean sheet on his debut in PSG's 2-0 victory over Metz on Friday, and former Fulham loanee Rico will now provide back-up to Navas.