There is more than one answer to this question:
First of all, the mail is pretty reliable in Spain, so yes, your parcel should arrive safely. But if your life depends on your medication, better be save than sorry and carry some extra with you. But be aware that shipping medication, as a private person, from another country to Spain and other European countries is NOT allowed, so don't try to send any meds from home!
Second, I assume that you are bringing your medication from home with you? Are you from outside the EU / Schengen? If yes, be aware that border control has tightened up considerably when it comes to medications. I have American friends that got questioned why they brought so much tablets when flying into Schengen. Make sure you have a letter from your doctor that details your situation, ideally translated into the local language of the country you arrive first.
Third, unless you are on something really rare or very expensive, chances are good that it is available also in Spain. There are pharmacies in abundance on the Camino, so bring a letter / prescription from your doctor to show to a Spanish doctor so that he can prescribe what you need.
Hope that helps and Buen Camino! SY