War of the Spanish Succession
The War of the Spanish Succession was a war between Austria and France over which of them would rule Spain and all of Spain's colonies in North and South America. When Charles II of Spain died in 1700 AD, he left no sons, and people disagreed about who should be the next king of Spain. Charles had named his grand-nephew, Philip, but Philip was Louis XIV's 16-year-old grandson, born at Versailles, and Austria and England were worried that Louis XIV, the king of France, would tell Philip what to do, and control both France and Spain, and all of Spain's colonies in the New World.
So Austria and England supported a different person, Charles' cousin Charles III, instead. Charles III was a 15-year-old from the Hapsburg family, growing up in Austria. France fought England and Austria not only in Europe but also in North America and India. By 1714, though, Charles' older brother had died, so he inherited power in Austria, and didn't care so much about ruling Spain anymore. Louis XIV got Austria and England to recognize Philip V as the King of Spain. But Louis had to agree that Philip wouldn't inherit France when Louis died, so France and Spain would be two separate countries and not joined into one giant empire. And Spain gave up the Straits of Gibraltar to England, and the Netherlands and southern Italy to Austria.
Philip ruled Spain for a long time. Even though Philip insisted on a new rule that prevented women from inheriting the Spanish throne equally with men, in fact his wife Elizabeth Farnese had a lot of power during his reign (like Maria Theresa in Austria at the same time). They began rebuilding Spain's economy after the silver problems of the Hapsburg kings, and worked to reclaim Elizabeth's family's power in southern Italy. But Spain still depended on that South American silver. And on the oceans Spain's navy had less and less power - Spain couldn't even trade with India or the American colonies anymore at all - while England's navy had more and more.