Im not well versed in world history and specially not in history of spain but i dont remember spain being that much involved in these wars.
So if the rest of europe went trough so much devastation why didnt spain experience a boom in ecenomy/power? They were colonial empire they should have resources to set up a big economy. Germany got crashed in two world wars and had almost zero colonies but are now one of the leading world economies and definetly the biggest in europe.
While it is true Spain avoided World War One and World War Two, it did fight a bloody civil war from 1936 to 1939. Around 700,000 people died in the Spanish Civil War. Despite being a smaller country than the United States, this was more than the number that died in the US Civil war.
Spain also lost most of its colonies in South and Central America between 1810 and 1825. With the exception of the colony of Spanish Saharan Africa, it lost the last vestiges of its colonial empire (Cuba, Puerto Rico and the Philippines) in 1898 in the wake of the Spanish American war.
The authoritarian Francisco Franco government of Spain had high tariffs and followed a policy of autarky which constricted trade and restrained economic growth. It was only after Franco died in 1975, that the Spanish government tried to integrate itself more closely with the European Union.
Source: "An Illustrated History of the Modern World" Lisa Isenman
Spain benefited quite a bit from WW1. Spanish companies made huge profits from exporting to the countries involved, which resulted in Spain having the fifth largest gold reserves in the world after the war.
Of course, 4 years of an excellent trading position doesn't turn a largely agricultural backwater into a modern nation, and then Spain was affected by the Great Depression along with everyone else resulting in high unemployment during the 30's.
Then, as already mentioned, came the Civil War. This nearly 3-year conflict killed 500,000 people (out of a total population of around 25 million) and unsurprisingly caused massive destruction to huge parts of Spain. Two memorable examples include Guernica, destroyed by German bombers, and Belchite, a small town destroyed during a massive Republican offensive.
Even with the war over, Spain couldn't replicate its WW1 success. They were forced to export huge quantities of raw materials (mainly minerals from the north) to Germany as debt repayment for their aid during the war.
It wasn't until the end of the autarkic policies some time in the 50's/60's that Spain saw an economic boom, known as the Spanish Miracle.
Sources:
Antony Beevor's The Battle for Spain
Paul Preston's The Spanish Civil War and The Spanish Holocaust
Michael Seidman's The Victorious Counterrevolution
One reason for this is that in many cases the economic impact of the world wars was temporary. Economic historians often view countries as having a relatively stable growth rate over the long term. The world wars (or at least world war 2) tended to damage this growth, but this was followed by particularly rapid growth afterwards, until the economy caught up with it's long-term trend. Thus we see France and Germany (and Japan) having long booms after WW2. The UK is the exception that proves the rule in this case, as its economy expanded during the war, and it grew relatively more slowly afterwards.
A further (and perhaps slightly contradictory) reason is that both wars encouraged a shakeup and modernisation of institutions. Germany came out of post-war reconstruction with a much more modern economic and political system. In the ECSC/EC Germany, France, and other countries were able to create a large and effective economic block that encouraged trade and growth.
I don't know much about Spain's politics and economics, but they seem to have stagnated under Franco. I'd echo the comments from /u/davratta. Spain was trying autarky and excluded from the EC, while much of the rest of Europe was reaping the benefits of increased trade and interdependence.