Despite losing some important wars in the past, the Spanish school of thought did not change much during the first half of the 20th Century. Spain's huge empire had disingrated during the course of three centuries and it still had ideas of expansion. They still had some colonies north of Morocco, where peace was difficult to achieve since they were constantly attacked by native tribes.
The Spanish thought it was a good excuse to start a war and perhaps conquer some new lands in the Africa. The Third Rif War took place during the 1930s, and in truth it was a complete disaster, with a high numer of casualties and it's consequent humilliation.
Stung by their failure, they responded to ensure such an event could not happen again. The Spanish Legion, which imitated the French Foreign Legion, was created. This had unintended consequences which altered Spanish history. When the left wing party coalition won the elections a few years later, quite a few of the Legion generals, plus much of the Spanish aristocracy, decided they wanted none of it.
The Spanish Civil War ensued. It was one of the bloodiest civil wars Spain has ever seen. The Guernica bombing shocked the world, one of Spain's most important poets, Federico Garcia Lorca was killed and his body was never found, among many emblematic episodes of the war.
It lasted no longer than 3 years, but it left a trail of hundreds of thousands of dead people, a similar number of exiles and a countless number of broken lives. Francisco Franco, leader of the nationalist side, established and became the head of a totalitarian government that lasted up to his death in 1975.
So after 5 centuries of warfare Spain is finally living a period of peace, even when in the civilized world wars of all sizes occur daily.