I agree that Spanish trains are usually on time, but I think there is one big exception -- the Trenhotel. Last year I took the overnight Trenhotel from Burgos to Paris with the plan to walk over to the Gare de Lyon and catch the airport bus to CDG. On the train, several of the women sharing my compartment told me that they were frequent riders on this train and that it was not unfrequently several hours late. Fortunately, we arrived within 45 minutes of scheduled time and I was able to make it to the airport by bus. You didn't say if you are on the trenhotel, but if you are, I would do some more investigation about on-time arrivals. I remember being told that for some reason the trenhotel has a lower priority and is frequently moved over to the side tracks to let other trains pass.
And about getting to the Madrid airport. If you are flying Iberia or a partner airline (American is the only one I'm sure about), you will check in and depart from the new T4. If you are flying any other airline, it's at the old airport terminals. Make sure you know which terminal you use, because they are far apart (in fact, there's a metro stop for Barajas the town in between the T1-2 stop and the T4 stop). Just last week, I went from Puerta del Sol to T4 in about 35 minutes (I believe the new metro stop opened the last week in May and it is very convenient, just an escalator down from T4 to the entrance). The metro ticket requires a 1E supplement.
Hope you have a great Camino!