Margaret Theresa of Spain and her husband, Emperor Leopold I of Habsburg, were closely related. Their kinship ties were as follows:
1. Uncle and niece: Margaret Theresa was the niece of Leopold I. Her mother, Maria Anna of Austria, was the elder sister of Leopold I, so Leopold was Margaret Theresa's maternal uncle.
2. First-degree cousins: Margaret Theresa and Leopold I were also first-degree cousins on the paternal side. Margaret Theresa's father, Philip IV of Spain, and Leopold I's father, Ferdinand III, were brothers, both sons of Emperor Ferdinand II and Maria Anna of Bavaria.
These close kinship ties reflect the marital practices of European royal families of the time, who often married within the family to maintain power and dynastic alliances within the same family circle.