Philip III of Spain had two sons: Philip IV and Ferdinand, Prince of Asturias. Philip IV was the heir to the throne and succeeded his father in 1621. Ferdinand died in 1646 without issue, so Philip IV was succeeded by his son, Charles II.
A Royal Rendezvous: Unveiling the Reign of Philip III of France