I guess it would depend on what you want to do. Tour, Eat/drink, just relax… Since you can get just about anywhere pretty easily a lot is on the table.
I might pick a city that you may not have an opportunity to easily get to again.
Gattinara / Ghemme are very close to Milano Malpensa, and a weekend wouldn’t leave you feeling like you’d need another week to get what you’d want out of it. If you want a town/city, then Novara is pleasingly under-touristed, yet with fine architecture / easy to stroll around.
Maybe there is an equivalent location at the Madrid end?
They are both exquisite! You have monuments in both places. I know there are Flamenco places in both Granada and Seville. Granada has some of the original gypsy caves in the Sacromonte, the Royal Chapel, Cathedral, the Albaicin and others. More than a couple days in each place is suficiente.
I really liked Segovia which is north-north-west of Madrid. There is a fair bit to see there. Suckling pig is also a big thing there (which may have contributed to my enjoyment of the city). I also liked Ronda in the South. San Sebastian would also be on my list of options
It is only a short flight to Lisbon or Porto from Madrid as well if you haven’t been. I’m not sure how easy it is to get to either from directly from Milan