Guerra de Sucesión Española
The Spanish lost the kingdom to the Austrians during the War of the Spanish Succession.