The Habsburg dynasty ruled Spain for over two centuries through a series of kings. They came to power after Juana of Castile married Philip of Habsburg. Their grandson Charles I became king of Spain. Under Charles I and his successor Philip II, the Habsburg Empire expanded greatly across Europe and the Americas but faced numerous revolts within Spain. By the 17th century under later kings, the empire was in decline due to mismanagement and overextension, culminating in the War of Spanish Succession after the childless death of Charles II in 1700.