Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
Political boundaries between Spain and neighboring territories
Spain, formally known as the Kingdom of Spain (Spanish: Reino de España), is a sovereign nation primarily situated on the Iberian Peninsula in South Europe. It also includes the archipelagos Canary Islands and Balearic Islands, along with overseas territories bordering Morocco located in North Africa. The mainland is bordered by the Mediterranean Sea to the south and east, except for a small land border with Gibraltar. To the north and northeast, it shares borders with France, Andorra, and the Bay of Biscay, while Portugal and the Atlantic Ocean lie to the west and northwest. Spain is one of only three countries, along with France and Morocco, to have coastlines on both the Atlantic and Mediterranean. The Portugal–Spain border, stretching 1,214 km (754 mi), is the longest continuous border within the European Union. As a matter of fact, the total length of the border shared by Spain reaches 1,928 kilometres (1,198 mi) long.
The borders of Ceuta and Melilla, are de facto, because between them and Morocco there is no man's land. The only real border would be the 27 meters long one in the Peñón de Vélez de la Gomera.