Aguirre replaces Gay as Zaragoza boss
Aguirre, who has also coached Atletico Madrid and Osasuna, has agreed a contract until the end of June with an option for one more year if the team avoids relegation.
"Coaching Real Zaragoza is a challenge, their history makes them one of the great Spanish teams," he told a news conference at the club's Romareda stadium.
"We have a squad with quality that is sufficient to get us out of this situation," he added. "What's more, there is a good deal of the season left and there is time to recover."
Aguirre, who will be 52 on December 1, ended his second stint as Mexico coach at the end of June after his team were beaten 3-1 by Argentina in the World Cup second round.
A former Mexico international, he established his reputation in the domestic league with Atlante and Pachuca before taking over as national coach in 2001 and guiding his country to the World Cup a year later.
A move to Spain with Osasuna followed and his relative success with limited resources earned him a job with Atletico.
After being sacked in February 2009, he returned to Mexico to replace Swede Sven-Goran Eriksson as Mexico coach and turned around the struggling team's fortunes as he led them to the Gold Cup title and World Cup qualification.
Gay was promoted from second-team coach at Zaragoza after Marcelino's sacking in December 2009, steering the club out of the relegation zone to finish the campaign in 14th place.
This season, Zaragoza have won just one of their 11 matches and have only seven points.
"I wanted to express my gratitude for the chance to coach in the first division," Gay told a news conference on Thursday. "I was able to fulfil a dream."
Zaragoza won the Inter-Cities Fairs Cup, the predecessor of the UEFA Cup, in 1964 by beating Valencia and they upset English club Arsenal in the European Cup Winners' Cup final in 1995. They have also won six Spanish King's Cups.
Nayim, who scored the spectacular winning goal against Arsenal, has also left his post as assistant coach to Gay, Zaragoza said on their website.