For people entering the EU / Schengen Zone for the first time, if you are making a direct flight connection at Madrid, your luggage should go automatically to Vigo. In the EU, people are cleared at passport control at the first place of landing (Madrid), and their luggage is cleared through customs at the final flight arrival destination (Vigo).
So, when I fly from the US to Santiago, via Madrid, I go through passport control at Madrid. Then I have to go through airline security again, before they permit me to proceed to my onward connecting flight to Santiago. Once I arrive at Santiago, I must proceed to a special baggage carousel for people like me, just arriving in the EU / Schengen Zone. Our bags are checked by customs officials there.
This contrasts with other countries, like the US, where everything is done at the first port of arrival, regardless of your connections.
All considered, I do NOT think you have enough time. I say this for two reasons.
1. Madrid Barajas airport is HUGE. Depending on connecting gates and terminals (there are four separate terminals), just getting from one gate to another could easily consume all your time.
2. Getting off the plane and through passport control might only take 10 - 15 minutes, as you must walk a long way to passport control.
3. Then you have to wait on line for security screening.
4. Then, you might have to wait for the underground tram (terminal 4 > 4S), or walk quite a distance to your connecting flight.
A clear example is my travel to Santiago when I travel from my home in Florida to Santiago. I try to fly Iberia, as (IMHO) it offers the best value for price and easiest connections.
Even with that home field advantage, getting from the arrival gate in T4, through passport control, wait in line for another security screening, then on the underground train to the satellite terminal (T4S), then walking the better part of a kilometer in the satellite terminal to find my departure gate takes at least 45 minutes. And I walk FAST making full use of moving walkways and every shortcut I am aware of.
Personally, having learned my lesson, I try to schedule a minimum two-hour connection at Barajas, just so I can freshen up in the restroom and have a decent cup of coffee and a croissant in the morning when I arrive.
This usually works heading over. But two weeks ago, coming home, I literally had to jog between connections, all in Terminal 4, going through departure passport control (WHAT a conga line!) and just made my departure gate...no coffee.
Hope this helps.