Yes, you can wear shorts in Spain. There are no rules or dress codes that say you can’t wear shorts. Shorts would be comfortable during the summer months. However, you can’t wear shorts to churches as there are strict dress codes when entering religious places.