Spain has endured a lot of conflict in its time, and every culture, from the Phoenicians to the Visigoths, has felt the need to protect itself and build powerful hilltop forts.
But you could say that the art of castle-building was perfected by the Moors after they crossed the Strait of Gibraltar in the 8th century to occupy much of Spain for 500 years.
The good news for us is that many centuries of turmoil have endowed Spain with innumerable fortresses to see, some awe-inspiring and oppressive, and others extravagant and palatial.
Let’s make a whistle-stop tour around the most beautiful castles in Spain:
1. Alhambra, Granada
The very first building constructed at this famed palace and garden ensemble was the fortress in the 1000s, so the Alhambra sneaks to the top of the most beautiful castles in the country.
You could lose a good couple of hours surveying the walls, barbican and tower of the citadel on the western side of the Sabika hill before moving on to the palaces and their innumerable patios, and of course the Generalife.
The Alhambra was built by the Moors, who later adapted it as a summer escape for Sultan Yusuf I. After Granada was re-conquered, the Catholic Monarchs held court here.
There may not be a more enchanting place in Spain today.
2. Castle of Loarre, Huesca
Surrounded only by countryside, this immense romanesque castle sits proudly on a promontory in the community of Aragon in north-eastern Spain.
It dates to the 11th century and was built by Sancho III of Pamplona to halt the advance of the Moors and to defend the fertile plains in the Hoya de Huesca.
What made it so impenetrable was its foundation of limestone bedrock that couldn’t be tunnelled under.
A great deal of the surviving castles in Spain from this time have Islamic origins, so Loarre is pretty unique for being Christian.
On a tour you’ll want to examine every inch of this building, including the 22-metre-high Tower of the Queen that stands behind the drawbridge.
3. Coca Castle, Segovia
After Spain was retaken from the Moors Arabic architecture remained in fashion and new buildings adopted the “mudéjar” style.
Coca Castle in Segovia, built for the Crown of Castile in the `15th century, demonstrates this beautifully.
The walls and towers have Moorish-style pointed merlons, and the interiors are full of nods to the Islamic period.
What’s unusual is that Coca isn’t perched high a hilltop like most castles in Spain, and instead is easy to approach on a low escarpment.
The building was more for showing off than fighting, and didn’t see a lot of action until the early 1800s when it was occupied by the French in the Peninsular War.
4. Lorca Castle, Murcia
At more than half a kilometre in length this immense fortress looming high over the Murcian city of Lorca is one of the largest in Spain.
Such is its size that in medieval times it contained Lorca’s entire Jewish quarter, a ghetto that was separated from the rest of the city outside these walls.
Excavations of this district are ongoing, but so far 12 homes and a synagogue have been unearthed.
The castle itself is Moorish, founded around the 800s, and later became a Christian base from which to attack the Muslim stronghold of Granada.
5. Castle of La Mota, Valladolid
In the town of Medina del Campo in Castile and León is this 14th-century castle made almost entirely from local red brick.
What will catch your attention straight away is the Torre del Homenaje, the castle’s 40-metre-high keep, defended on four sides at the top by turrets.
If you get up close you’ll see how various sieges in the 1400s left pockmarks caused by cannonballs in the walls of its main tower.
For a time the castle was the core of a large citadel, but few signs of this walled settlement remain today.
What’s left is magnificent though – and free to enter!
6. Peñafiel Castle, Valladolid
Also in Castile and León is this white hill-top castle with a strange footprint.
Peñafiel Castle fits the narrow contours of the lofty ridge on which it’s perched, giving it an elongated outline of a ship.
It’s more than 200 hundred metres long, but at no point is it wider than 35 metres.
Built in the 9th century it was taken by Almanzor, the Moorish ruler, in 983, before being regained for good by the Christians in 1013. Its current appearance, with round towers and a rectangular keep, comes from the 15th century when it was redesigned according to the Valladolid School, similar to the Castle of Mota.
7. Palacio Real de Olite, Navarre
In medieval times this storybook palace, seat of the Kings of Navarre, was the last word in luxury in Europe.
In the 1100s a German traveller wrote, “Surely there is no king with a more beautiful castle or palace and with so many gilded rooms.
” Part of its charm is its irregularity, with a whimsical mishmash of walls and towers of different sizes and outlines, which only adds to its fairytale quality.
As you saunter through the chambers, courtyards and gardens you’ll get a glimpse of the high-end lifestyle that kings led.
The hanging gardens were suspended 20 metres above the ground and there was even space for a menagerie that contained lions.
8. Alcázar of Segovia
This Disney-style castle with its tall circular towers capped with conical roofs is also better known as a lap of luxury than a military stronghold.
The Kings of Castile loved to spend time here and even now it’s not hard to see why.
Like Peñafiel this castle had to adapt to its environment, and on this rocky promontory it has the same narrow, ship-like appearance.
The keep (Torre de Juan) is special, with 12 ornamental turrets on its roof.
You can scale the spiral stairway with 156 steps for panoramas of Segovia old-town.
Within the palace there’s loads to see, including the extravagant Sala de los Reyes, adorned with a gilded frieze depicting the 52 Kings of Castile, León and Asturias.
9. Castillo de Belmonte, Cuenca
On a hill commanding views of the town of Belmonte and the flat, ochre-coloured landscape around it is this 15th-century mudéjar-gothic fortress.
It was built by Don Juan Pacheco, the First Marquis of Villena as he prepared for trouble during a time of infighting in the Kingdom of Castile.
This was when artillery was coming into play, so despite its raised location the castle is only one story high, and has deflective cylindrical towers.
You can pick up an audio guide at the entrance, and this will give you all sorts of insightful facts as you go.
Take extra time at the Armoury to see the medieval weapons and armour, and in the Bedroom of the Empress, which has geometric coffered ceilings.
10. Bellver Castle, Majorca
You’ll spot this circular gothic castle from Palma’s port, climbing above the west of the city.
Bellver Castle is made of honey-coloured limestone and was erected in the 14th-century for King James of Majorca.
It was the seat of power for a succession of Kings of Majorca and saw a lot of bloodshed in its day, surviving two sieges and then falling during the Revolt of the Brotherhood in the 16th century.
From the late-Middle Ages onwards the castle was a prison during conflicts like the War of Spanish Succession in the 1700s and the Peninsular War in the 1800s.
Now you you’re free to come and go as you like, to see the history museum inside or watch a summer concert in the round arcaded courtyard.
11. Miravet Castle, Tarragona
There isn’t as much remaining of this Catalan castle as others on this list, but you cannot argue with Miravet’s location, soaring on a rocky spur above the River Ebro.
The castle is an austere fortress with powerful square walls.
It has Moorish origins, but was captured by the Christians in the mid-12th-century and turned into a fortified monastery by the Knights Templar.
Inside you can step into the romanesque chapel, which has been well preserved, and climb the precarious stairway to the roof of the keep.
From there you’ll see the broad green ribbon of the Ebro spooling down from the mountains.
12. Castillo de Burgalimar, Jaen
Many of the castles on this list have Islamic origins, but few if any retain as much of their original Moorish design.
Above the town of Baños de la Encina in northern Andalusia is an oval 10th century fortress that proves just how sturdy Moorish military architecture could be.
It required a serious effort to wrest the stronghold from Islamic hands, and this was finally achieved in 1225. After that a Christian Tower of Homage was built around one of the structure’s 15 original bastions.
The best way to enter the compound is to take the southern gate, through two Arab horseshoe arches.
13. Alcazaba of Málaga
Another marvellous piece of Muslim heritage is this 11th-century fortified palace that holds sway behind the harbour in Málaga.
When it was built the Alcazaba defended the eastern side of an entire walled district of the city, with a sophisticated sewer system that was highly advanced for the era.
Little of this remains, but that doesn’t take away from the serene refinement of the upper enclosure within two sets of tough, crenellated walls.
You’ll enter the courtyards of the Nasrid Palace, where you have to keep your eyes peeled to catch every exciting details, like the thousand-year-old Kufic inscriptions on the columns.
14. Peñíscola Castle, Valencia
Here’s another castle that earns its place on the list for its wonderful location.
The port of Peñíscola, on the coast of the Castellón Province, is often named among the most beautiful villages in Spain: It’s a walled historic quarter on a large rock at the end of a very narrow isthmus flanked by sandy beaches.
The castle as we see it was the work of the Knights Templar in the 1100s, and in the 15th century it was home to the Antipope Benedict XIII for the last six years of his life.
As you’re almost completely surrounded by the sea, the vistas from parapet of the main tower are amazing, especially early in the morning.
15. Castillo de Vélez-Blanco, Almería
You will sympathise with medieval invaders when you see the indomitable towers of this fortress protected by rocky crags over the town.
Originally it belonged to a Muslim citadel, but was granted to the 15th-century nobleman Pedro Fajardo by the Catholic Monarchs.
He gave the castle’s interior a lavish renaissance redesign, which now sits in the Met in New York after the owner sold the bailey’s furnishings off in 1904. There’s still a lot to love about the castle’s exterior when you peek between the merlons for a wonderful panorama across the valley.