Some of them are in the fire ant family so be careful. There are many species in Spain, as you can see on the list, consider yourself lucky if you find 10 different species. (the same as in England ore here in Belgium, much species but you don't find them all)
Be careful with shipping, i think it is better if you look into it, if it is legal that you take ants to your country (from Spain).
I've taken ants in my hand luggage plenty of times. I really don't think it's that likely that you would get in trouble. They are looking for drugs or things that they can tax. What's the worse that could happen? There are no laws against bringing in Ants as far as I know. So at worse they might hold you to check out whether it's legal, or they might confiscate them.
I suspect the customs officials would have the same reaction to most people. 'Eurggghh, bugs'. They will probably think you are mad but let you go.
I agree about keeping them in your hand luggage though. The hold get's very cold.