I am flying on Iberia airlines from Miami to Rome, with a 1 hour stop in Madrid, Spain. Do I have to take my luggage through customs in Madrid?
Usually you do not need to take luggage and custom. You will have just regular tag on your checked baggage, so that custom in Rome know if they could fine you for custom regulations. Tags with green bands are intra-EU baggage.
There could be exceptions, but you will know at departure airport, at check-in.
Note: your immigration procedures are done in Madrid, because you will enter there to Schengen Area. Just custom is done (usually) at destination. Note: Schengen Area and EU custom Area are different concepts and they have different borders.