On 21 August 2012, Ayala joined Deportivo Alavés on loan for the 2012–13 season.[5] On 21 August 2013, he moved to Valencia Mestalla on loan.[6] After featuring 33 times for the side, he signed permanently with the club on 14 July 2014.[7] On 20 September 2015, he scored his first goal for the club in a 2–3 defeat against UE Cornellà.[8]
On 25 July 2017, Ayala moved abroad for the first time, signing for Belgian club Sint-Truidense V.V. on a one-year contract.[9] On 13 July 2018, he returned to Spain and joined FC Cartagena for the upcoming season.[10]