Gomez spent two seasons at City after signing in 2022 from Anderlecht.
The 23-year-old’s spell at the Etihad saw him make 38 appearances as he helped the Blues win six trophies.
The left-back was part of the squad that won the Treble of Premier League, FA Cup and UEFA Champions League in 2022/23 followed by the UEFA Super Cup, FIFA Club World Cup and Premier League across 2023/24.
He made his Premier League debut in the 4-2 home win over Crystal Palace in August 2022, coming on for hat-trick hero Erling Haaland and then made his Champions League debut the following week, starting in a 4-0 away win at Sevilla.
In total, in that first campaign, he made 12 top-flight appearances, five appearances in the Champions League, four in the FA Cup and two in the Carabao Cup.
The following term, Gomez managed 15 appearances for the Blues, starting twice, in the Carabao Cup clash at Newcastle United and the Champions League win away to Red Star Belgrade as well as claiming a first Premier League assist in the 5-1 win over Fulham in September 2023, setting up star striker Haaland for the final goal of the afternoon.
Now he will take on a new challenge at La Real under boss Imanol Alguacil in La Liga.
“It’s time to leave Manchester City but I’d like to thank everyone at the CFA for their support and guidance during my time at the Club,” said the Spaniard.
“Being part of such a talented, ambitious and successful squad was a true honour and winning a host of major trophies, including the Treble, is something I will never forget and will always look back fondly on.
“I am excited for this new adventure but I wish Pep Guardiola and the players every success in the future.”
Director of Football, Txiki Begiristain, added: “I’d like to thank Sergio for his time at Manchester City.
“He is an impressive young footballer, with a good attitude and strong application, who I have no doubt will make his mark and excel in the coming years.
“We wish him the best for the future.”
Everyone at Manchester City sends their best wishes to Sergio ahead of his move to Real Sociedad.