Have you set up Easy Roam on your plan? Setting it up also triggers the International Roaming option on your plan. Without International Roaming, your phone won't connect to international partners.
Have you had success connecting to local carriers in other countries on your travels, or is the issue unique to Spain?
If you find a post useful, please give the author a "Kudo"