Alphonso, finding his tenure of the throne uncertain on account of the approaching invasion of Charles VIII of France and the general dissatisfaction of his subjects, abdicated in Ferdinand's favour on 23 January 1495.
The 24-year-old new king tried to resist, but the French troops had already occupied much of the northern territories of the Kingdom. The Neapolitan troops on the Liri and Garigliano rivers were obliged to retreat when the fortesses of Capua and Gaeta fell. The treason of a party in Naples rendered it impossible to defend the city against the approach of Charles VIII, who entered Naples on 20 February 1495. In the capital, only Castel dell'Ovo resisted, defended by Alfonso d'Avalos.
Ferdinand fled to the castle at Ischia with an escort of 14 galleys, together with the royal family, the general Innico d'Avalos and the poet Jacopo Sannazaro. The commander of the island fortress had already made an agreement with the French, and opposed the King Ferdinand's entrance. When the two met, Ferdinand killed the commander personally, and had his body thrown into the sea. Ferdinand later moved to Messina, where he joined his cousin Ferdinand II, king of Sicily and Spain.
In the meantime, Pope Alexander VI, (Rodrigo Borgia of Aragon before his election as pope) formed a coalition against Charles, made up of Emperor Maximilian, Venice, Milan and Spain. When the French king left Naples with most of his army, Ferdinand disembarked at Seminara in Calabria, forcing his way north to Naples. Blocked by French garrisons at Palmi, he decided to return to Naples by sea, and was again at Ischia (which had victoriously pushed back the French attacks) on 7 July 1496. The same day he was again in Naples: the citizens, irritated by the terrible conduct of their French conquerors during the occupation of the city, received him back with enthusiasm.
With the aid of the great Spanish general Gonzalo Fernández de Córdoba, Ferdinand was able to rid his state completely of its invaders shortly before his death.
In August 1496, with the kingdom firmly back in his hands, Naples was able to celebrate Ferdinand's wedding to his 18-year-old half-aunt Joanna. Joanna was the late-born daughter of Ferdinand's grandfather Ferdinand I and his second wife, Joanna of Aragon. She was actually younger than Ferdinand, who was 27.
After the wedding the royal couple decided to leave Naples and moved to Somma-Vesuvius. Here the king was struck with an illness and died within a few days, on 7 September 1496, a little over a year after his accession.
In the absence of direct heirs of the deceased king, the crown was inherited by his uncle Frederick, legitimate brother of his father, Alfonso II.