Felipe was born in Valladolid, Spain on 8 April 1605, the son of King Felipe III of Spain and Margaret of Austria, Queen of Spain. Both of his parents belonged to the powerful German House of Habsburg, and he was ordered to marry Elisabeth of France in 1615 in an attempt to make peace between the Habsburgs and the House of Bourbon. However, Felipe's ministers kept the couple separated and encouraged Felipe to take mistresses, hoping to maintain their influence over him. In 1621, Felipe became King of Spain on his father's death, and he made Cardinal Francisco Gomez de Sandoval his chief minister. Felipe was persuaded to pursue an aggressive foreign policy and an alliance with the Holy Roman Empire by his ministers, and he joined the Catholic alliance during the Thirty Years' War, consequently resuming the Dutch Revolt in the Netherlands.
Failed campaignsIn 1624, the Spanish took Breda from the Dutch, and they succeeded in raising a fresh army in the mid-1630s and using it to defeat Sweden at the First Battle of Nordlingen in 1634. In 1635, France declared war on Spain, hoping to maintain the balance of power in Europe by halting Habsburg expansion; Felipe pursued a "Netherlands-first" strategy, focusing on fighting the Dutch instead of fighting the French. In 1643, the Spanish suffered a disastrous defeat at Rocroi, followed by another defeat in Lens in 1648; both defeats proved that the Spanish tercio was no longer invincible.
In 1640, Portugal rebelled against Spain as rebellions broke out across the country, and Portugal succeeded in becoming an independent kingdom and in maintaining its independence after several skirmishes with the Spanish. In 1648, Felipe was forced to make peace with the Dutch, granting the United Provinces its independence, but he would fight against France for another decade, while the Portuguese fought on until their victoy in 1668. Felipe did, however, succeed in crushing a French-backed revolt in Catalonia. His failures to reform Spain's bureaucracy and military led to Spain's power declining, and his mentally-ill son Carlos II of Spain would succeed him on his 1665 death, becoming the last Habsburg to rule over Spain.