The 31-year-old had made 16 appearances for the Latics over the first half of the season after rejoining the club for a second spell from Sunderland last summer.
However, his latest stint at the DW Stadium comes to an end after just six months as he completes a permanent move to Segunda Division side Rayo.
"Wigan Athletic will always be a club so close to my heart because of what has happened in the past, and I want to say goodbye and thank you to all the supporters," Gomez told Wigan's official website.
Wigan boss Warren Joyce added: "Prior to my arrival here Jordi had asked whether he could go back to Spain if something came up in this transfer window and we wish him all the best."
Gomez made 179 appearances for Wigan over his two spells, scoring 31 goals.