Presumed you were flying to Madrid first and going from Terminal 1 but if you are flying Air Transat and going via Terminal 3, you can scrap all that info given. Bags may not be checked through, you will have to leave the terminal, reclear security etc. No customs involved unless you mean USA to include domestic.
You have to be a bit more specific where you are coming from and going to and with what airline. . .