Ayala entered Spanish navy in 1760.
In early 1770s the Spanish royal authorities ordered an exploration of the north coast of California. Ayala was among the sailors sent to New World for this purpose. He arrived in Vera Cruz in August, 1774 and proceeded to Mexico City to receive orders from the Viceroy, Frey Don Antonio María de Bucareli y Ursua.
Bucareli sent him to San Blas where he took command of the schooner Sonora, part of a squadron under the general command of Don Bruno de Heceta, in the frigate Santiago. The squadron sailed from San Blas in March 1775. However, when they were lying outside San Blas about to set out, the commander of the packet boat San Carlos, Don Miguel Manrique, was taken ill - some sources say that he went mad. Ayala was ordered to take command of this larger vessel, sailed back to San Blas to land the unfortunate Manrique, and rejoined the squadron after a few days' sailing. Ayala was designated to pass through the strait and explore what lay within, while the Santiago and Sonora continued northwards.
The San Carlos reached Monterey on June 27, leaving there on 26 July and then proceeding northwards. Ayala passed through the Golden Gate on 5 August 1775
Ayala spent August and much of September exploring the bay, heading back on September 18.
On November 9 he reported to the Viceroy, calling San Francisco Bay the best port he had seen northward from Cape Horn.
He had found that the bay had a practicable entrance and not merely one port but many. There was plenty of fresh water, fire-wood, and stone. The climate was relatively cold but healthful, and free from the fogs which beset Monterey.
In his survey of the bay through his two pilots, José Canizares and Juan Bautista Aguirre, Ayala makes mention of points such as Angel Island, Round Bay (San Pablo), Mission Bay and Alkatraz Island.
Ayala had achieved the rank of captain by 1782 and retired on March 14, 1785 on full pay on account of his achievements in exploring California.
There is no record of his family.