The 27-year-old midfielder joined Zaragoza from home-town club Atletico in 2007 and played 142 games during his four seasons at the club, the last two of which saw him wear the captain's armband.
Last season he scored 11 goals, including both in Zaragoza's final-day 2-1 victory at Levante as they finished two points above the relegation zone.
Speaking at a Zaragoza press conference, Gabi said: "I will always carry Zaragoza in my heart. I want to give thanks to everyone who has been so good during my time here, as much to me as my family.
"Real Zaragoza have made me regain my enthusiasm for football."