score:4
To allow an interchange without re-clearing security a few things must hold.
Upvote:3
As you're transferring from an inter-Schengen flight to a flight leaving the Schengen area, you're going to have to go through passport check at the very least.
Customs is USUALLY only applicable to arriving passengers.
Security depends on the airport and even the terminal. Some have it once on entering the airport, others have it on entering the terminal, others still at every gate, and I've been to airports that had all three systems in place, where you went through security screening at least 3 times before boarding your flight.
I'm not familiar with the situation at Madrid Barajas, but I'd be surprised if you can travel from one terminal to another without some form of security check.
So you're likely going to have to go through security, especially if your departing flight is from a different terminal from the arriving one.