Carlos II was the last Habsburg ruler of Spain while Maria Anna of the Palatinate-Neuburg was his second wife, following Marie-Louise d’Orléans. She resisted the Borbón family so she was expelled from Spain and spent most of her last years in Bayonne, France before being allowed back into Spain before her death in 1740. Her Wikipedia article is here.

Maria Anna (1667-1740), Pfalzgräfin bei Rhein zu Neuburg, Königin von Spanien by W. Humer (Stadtmuseum Düsseldorf - Düsseldorf, Nordrhein-Westfalen, Germany)
