That is plenty of time!!!
If you are taking a flight during week days, the Metro will take you to and from the airport to the city center in no more than 30 minutes. That gives you tons of time to walk around down town, take the tourist bus as suggested here, eat at a good restaurant and even visit El Prado or Reina Sofia museums to see some Picasso, Dali or Velazquez paintings.
Enjoy the trip and sleep on the way to MAD to avoid checking into a hotel. It is not worth it. Your bags will be checked in up until Venice and return to the airport with time, as Iberia lounges are very nice.