Spain (officially the Kingdom of Spain), is a sovereign state located on the Iberian Peninsula in southwestern Europe. Its mainland is bordered to the south and east by the Mediterranean Sea except for a small land boundary with Gibraltar; to the north and northeast by France, Andorra, and the Bay of Biscay; and to the west and northwest by Portugal and the Atlantic Ocean. Along with France and Morocco, it is one of only three countries to have both Atlantic and Mediterranean coastlines. Spain's 1,214 km border with Portugal is the longest uninterrupted border within the European Union.
De facto, the country was united by King Charles V, who was the first king to rule Castile and Aragon simultaneously in his own right, and as a result he is often referred to as the first king of Spain. De jure, the country as a unified entity was created by the Nueva Planta decrees (Spanish: Decretos de Nueva Planta, Catalan: Decrets de Nova Planta). These were a number of decrees signed between 1707 and 1716 by Philip V - the first Bourbon king of Spain - during and shortly after the end of the War of the Spanish Succession by the Treaty of Utrecht.
Angered by what he saw as sedition by the Catalans and taking his native France as a model of a centralized state, Philip V suppressed the institutions, privileges, and the ancient charters (Spanish: fueros, Catalan: furs) of almost all the areas that were formerly part of the Crown of Aragon (Aragon, Catalonia, Valencia, and the Balearic Islands). The decrees ruled that all the territories in the Crown of Aragon except the Aran Valley were to be ruled by the laws of Castile ("the most praiseworthy in all the Universe" according to the 1707 decree), embedding these regions in a new, and nearly uniformly administered, centralized Spain.
The other historic territories - Navarre and the other Basque territories - supported Philip V initially, whom they saw as belonging to the lineage of Henry III of Navarre, but after Philip V's military campaign to crush the Basque uprising, he backed down on his intent to suppress home rule.
The acts abolishing the charters were promulgated in 1707 in Valencia and Aragon, in 1715 in Majorca and the other Balearic Islands (with the exception of Minorca, a colony of the Kingdom of Great Britain at the time), and finally in Catalonia on 16 January 1716.
The decrees effectively created a Spanish citizenship or nationality, that judicially did not distinguish between Castillian and Aragonese anymore, both with respect to rights and law. They abolished internal borders and customs except for the Basque territory, giving grant to all Spaniards to trade with American colonies (not only Castillians, as before).
Spanish territory also includes two archipelagos; the Balearic Islands, in the Mediterranean Sea, and the Canary Islands, in the Atlantic Ocean off the African coast; two major exclaves, Ceuta and Melilla, in continental North Africa; and the islands and peñones (rocks) of Alborán, Alhucemas, Chafarinas and Vélez de la Gomera. With an area of 504,645 km2, Spain is the second largest country in Western Europe and the European Union, and the fourth largest country in Europe. By population, Spain is the sixth largest in Europe and the fifth in the European Union.