Born in Granada, at the age of 16 he went to Madrid, where he studied Law and Humanities. During those years he published his first two novels, Tragicomedia de un hombre sin espíritu (Tragicomedy of a Spiritless Man) and Historia de un amanecer (A Sunrise Tale).
He was a frequent collaborator of Revista de Occidente and Gaceta Literaria. He lived in Berlin from 1929 and 1931, during the advent of Nazism. He got a Ph.D. in Laws at the Universidad de Madrid, where he would also be a teacher.
At the beginning of the Republic he became a lawyer for the Parliament. He was lecturing in South America when the Spanish Civil War erupted; he worked for the Ministry of Foreign Affairs during the war.
When the Republican side lost the war, he exiled in Buenos Aires, where he spent ten years. There he worked for the magazine Sur, the newspaper La Nación and the publisher Losada. He also founded, along with fellow Spaniard Lorenzo Luzuriaga, the magazine Realidad.
During the '50s he moved to Puerto Rico, where he would teach at the Law school in the University of Puerto Rico, invited by Dean Manuel Rodríguez Ramos. He later went to the United States, where he taught Spanish Literature at the Universities of Princeton, Rutgers, New York and Chicago, though he kept close intellectual and cultural bounds with Puerto Rico, where other noted Spaniards, such as Pau Casals and Juan Ramón Jiménez, were also exiled.
He returned to Spain first in 1960. From that year onwards he would return every summer and bought a house there, rejoining literary life. In 1976, after Franco's death, he moved to Madrid for good, where he continued his work as a writer, lecturer and journalist. In 1983, at the age of 77, he was elected for the Real Academia Española. He kept on writing to a very old age. In 1988 he received the Premio Nacional de las Letras Españolas. In 1991 he received the Miguel de Cervantes Prize and, in 1998, the Prince of Asturias Award in Literature.
Critics have usually divided Ayala's work in two stages: before and after the Spanish Civil War.
During his first stage, before the Civil War, Tragicomedia de un hombre sin espíritu (Tragicomedy of a Spiritless Man, 1925) and Historia de un amanecer (A Sunrise Tale, 1926) follow a traditional narrative line. With El boxeador y el ángel (The Boxer and the Angel, 1929) and Cazador en el alba (Hunter at Dawn, 1930) he embraced avant-garde prose. Both tale collections feature a metaphorical style, stylistically brilliant, with a lack of interest in the anecdotical and a fascination for the modern world.
After a long silence, Ayala begun his second stage in exile with El hechizado (The Bewitched, 1944), a tale of a Creole man trying to meet King Charles II of Spain (known as the Bewitched), which became part of Los usurpadores (The Usurpers, 1949), a collection of seven narrations with the common theme of lust for power. The story is used here as a reflection on the past, in order to better know the present. Ayala gets closer here to Kafka's existential and absurd world, including an implicit critic to the inmorality and stupidity of power.
La cabeza del cordero (The Lamb Head, 1949) is a collection of tales on the Civil War, where he pays more attention to the analysis of passions and human behaviour than to the relation of outside developments. Muertes de perro (Dog Deaths, 1958) denounced the situation of a country under a dictatorship, while presenting human degradation in a world with no values. El fondo del vaso (The Bottom of the Glass, 1962) complements his previous novel, which is commented by several characters. Irony becomes a central resource in this work, though a greater understanding for the human being replaces despise.
After these novels, Ayala kept publishing short tales, such as those collected in El As de Bastos (The Ace of Staves, 1963), El rapto (The Kidnap, 1965), and El jardín de las delicias (The Garden of Earthly Delights, 1971). The latest features a contrast between the satyric objectivity in the first part, Diablo mundo (Devil World), and the evocative, subjective and lyrical tone in the second, Días felices (Happy Days). These works were followed by De triunfos y penas (Of Triumph and Sorrow, 1982) and El jardín de las malicias (The Garden of Earthly Malice, 1988), where he collected six tales written at different times in his life.
Ayala was also a prolific essay writer, covering political and social aspects, as well as reflections on Spain's past and present, cinema and literature.
He wrote his memoirs, Recuerdos y olvidos (Reminiscences and Overlooks, 1982, 1983, 1988, 2006). He was a member of the Academia de Buenas Letras de Granada. In November 2003 he was proclaimed Honorary Fellow of the association Granada Histórica at his birthplace. He mentioned that was "maybe, one of the most beautiful moments in the last stage of my life because, after nearly a century of feeling a granadino across the world, now I feel recognised by the granadinos themselves".
His short story El Tajo (The Tagus) was included in Partes de guerra (War Reports), an antology of tales about the Spanish Civil War by Spanish writer Ignacio Martínez de Pisón.
He was a member of the European Academy of Sciences and Arts since 1997.
In 2007 he became the first donor for the Caja de las Letras (Letter Vault) of the Instituto Cervantes.
Francisco Ayala died in Madrid, 3 November 2009, at the age of 103. He was cremated at the San Isidro cemetery in Madrid.