All of Iberia’s (and Iberia’s partners’) flights go in and out of T4 at the Madrid airport. Assuming that this is one ticket, it must be a legal connection. That means that the people in charge have decided that it’s enough time for you to make the connection. You can take comfort in knowing that if a huge number of people with this connection time did not make their connection, the airlines would not continue booking it - it is no fun, and not cheap and/or easy, for the airlines to rebook you.
It is a tight connection, and if your flight into Madrid is late, or if the immigration lines are extraordinarily long, you may not make it. You will have to go through security again! And as one last point, non-EU flights arrive in T4S (S is for satellite), and you have a 4 minute train ride to get back to the ”main” T4, where your flight to Santiago is likely to depart.
If it’s one ticket the airlines will have to rebook you if you miss the connection. If you bought two separate tickets, and if you miss your connection, it is your problelm.
Here is what I wrote in my blog in September 2021, just so you can take some comfort knowing that this could all work out well.
I got off the plane at 6:35 and by 7:15 I had been through immigration, taken the train to the main terminal T4, gone through the vaccination check, taken the commuter train to the Chamartin train station, and was drinking my first cafe con leche waiting for the train to take me to Salamanca to start the camino.
Since you have the tickets already, you should just hope for the best and do your best to make it! Familiarize yourself with the setup of the airport. Always take the elevator and not the escalator, because, for instance from immigration/arrival down to the train is three huge flights.
And one important point — you do NOT pick up your checked bag in Madrid, it will be checked all of the way through to Santiago!
Good luck!