Bob, where is your connecting flight taking you? Can you take the bag with you to your final destination and mail it from there? How soon will you be in Santiago? The Spanish Correos is very efficient and your bag more than likely will be waiting for you when you're done with your Camino. I have sent bags ahead a couple of times without any delays or problems - not from the airport though. From Irún a couple of times and from Zamora another time.
The Correos at Barajas is in T1, at the arrivals level. It has been closed for a couple of years, but maybe it has re-opened. I have seen indications of its hours of operation online with no notation that it is closed, but maybe someone has first hand information.
The Correos is actually outside of the terminal, which means that you will have to leave and go through the main security again to get to your connecting flight. In the best of circumstances that requires a non-trivial amount of time.
If you are arriving in T4 (the new terminal used by Iberia Airlines and its partners), not only do you have to leave the terminal, but you also have to take the intra-airport bus over to T1 and then take the bus back again. If you are arriving and departing on a non-Iberia partner (say Delta and Air Europa), you will not have to change terminals but you will have to leave and re-enter.
If this is confusing, tell us which airlines you are arriving on and which airlines you are departing on and we can give better information about the logistics. But, as @Peregrina 2013 notes, it may be easier to take the bag with you to your destination in Spain and mail it from there.
Making the connecting flight to San Sebastián from Madrid was tight, so I just carried the extra bag with me to SJPDP, and sent it to Santiago via Bouricott. Now in Roncevalles after two wet and cold days. Looks like another wet and cold day to Zubiri. I’m now ready to embrace a scorching Camino summer.