Answer
Philip IV died in 1665, during a period of political and economic turmoil in Spain. His death marked the end of the Habsburg dynasty in Spain and the beginning of the Bourbon dynasty. Philip IV's reign was marked by wars with France and Portugal, as well as financial difficulties and social unrest. His death left Spain in a weakened state, both politically and economically.