The Spanish crown duly passed to the Hapsburgs, and Spain remained in their hands until the feeble-minded Carlos II died in 1700, leaving no heir.
Carlos II was the last Hapsburg ruler of Spain.
The Hapsburgs have never ruled Spain.