information:highlighting
Aragonese and Spanish

Sicily and Naples were separated since 1282, but remained dependencies of Aragon under Ferdinand I. The new dynasty enhanced Naples' commercial standing by establishing relations with the Iberian Peninsula. Naples also became a centre of the Renaissance, with artists such as Laurana, da Messina, Sannazzaro and Poliziano arriving in the city. In 1501, Naples came under direct rule from France under Louis XII, with the Neapolitan king Frederick being taken as a prisoner to France; however, this state of affairs did not last long, as Spain won Naples from the French at the Battle of Garigliano in 1503.

Following the Spanish victory, Naples became part of the Spanish Empire, and remained so throughout the Spanish Habsburg period. The Spanish sent viceroys to Naples to directly deal with local issues: the most important of these viceroys was Pedro Álvarez de Toledo, who was responsible for considerable social, economic and urban reforms in the city; he also tried to introduce the Inquisition. In 1544, around 7,000 people were taken as slaves by Barbary pirates and brought to the Barbary Coast of North Africa (see Sack of Naples).

By the 17th century, Naples had become Europe's second-largest city – second only to Paris – and the largest European Mediterranean city, with around 250,000 inhabitants. The city was a major cultural centre during the Baroque era, being home to artists such as Caravaggio, Salvator Rosa and Bernini, philosophers such as Bernardino Telesio, Giordano Bruno, Tommaso Campanella and Giambattista Vico, and writers such as Giambattista Marino. A revolution led by the local fisherman Masaniello saw the creation of a brief independent Neapolitan Republic in 1647. However, this lasted only a few months before Spanish rule was reasserted. In 1656, an outbreak of bubonic plague killed about half of Naples' 300,000 inhabitants.

In 1714, Spanish rule over Naples came to an end as a result of the War of the Spanish Succession; the Austrian Charles VI ruled the city from Vienna through viceroys of his own. However, the War of the Polish Succession saw the Spanish regain Sicily and Naples as part of a personal union, with the 1738 Treaty of Vienna recognising the two polities as independent under a cadet branch of the Spanish Bourbons.

In 1755, the Duke of Noja commissioned an accurate topographic map of Naples, later known as the Map of the Duke of Noja, employing rigorous surveying accuracy and becoming an essential urban planning tool for Naples.

During the time of Ferdinand IV, the effects of the French Revolution were felt in Naples: Horatio Nelson, an ally of the Bourbons, arrived in the city in 1798 to warn against the French republicans. Ferdinand was forced to retreat and fled to Palermo, where he was protected by a British fleet. However, Naples' lower class lazzaroni were strongly pious and royalist, favouring the Bourbons; in the mêlée that followed, they fought the Neapolitan pro-Republican aristocracy, causing a civil war.

Eventually, the Republicans conquered Castel Sant'Elmo and proclaimed a Parthenopaean Republic, secured by the French Army. A counter-revolutionary religious army of lazzaroni known as the sanfedisti under Cardinal Fabrizio Ruffo was raised; they met with great success, and the French were forced to surrender the Neapolitan castles, with their fleet sailing back to Toulon.

Ferdinand IV was restored as king; however, after only seven years, Napoleon conquered the kingdom and installed Bonapartist kings, including installing his brother Joseph Bonaparte. With the help of the Austrian Empire and its allies, the Bonapartists were defeated in the Neapolitan War. Ferdinand IV once again regained the throne and the kingdom.