It's likely some type of woodworm.
They are not really worms but beetle larvae.
One of the more aggressive types is the "Furniture beetle." They are common in the warm climate of southern Spain where people treat their homes like we treat for termites in the US. They have been known to eat fine furniture, bathroom doors and yes, guitars. In Spanish they are called Carcoma. The OP said his guitar was from Spain. I have relatives over there. These things are a real pest and if still in the guitar or the eggs are in the guitar then it is a definite risk to other areas of the OP's home.
Here are a few random google links...
Some Spanish Exterminator
Info about various Spanish wood eating beetles.
Andalucia Forums
Turnstone Guitar Company article
Youtube embeds don't seem to work but here is a link to a guy who's homemade Telecaster got eaten.
https://www.youtube.com/watch?v=qi5WrFS87Wo
Sorry to hear this. I wish the OP good luck.
-Tim-