The 18th century dawned on Spain with a huge royalty problem, a succession war. Charles II died leaving no direct heir. Upon his death bed he did however name his half sister's grandson as the next king. So a Bourbon (French royal family) became King Philip V of Spain. So now the Brits were not satisfied at all with this situation. It didn't fear Spain as much as it feared France, but what would happen if it became one kingdom? We shall never know, but the new king did annoy the English and the Dutch by cutting off trade routes and ports and these countries, along with Austria and Portugal supported a contestant to the crown. In the end Philip V wins, but at a high cost.
The 18th Century wasn't a great success for Spain. After losing a large portion of their empire, which diminished their influence in Europe, they tried to regain their prominence by trying to conquer some lands or recover what had once been theirs.
The siege of Gibraltar is a good example of this. Gibraltar had been occupied by the British for a very long time, something that had been a stone in Spain's shoe since the beginning. Now they planned to recover it, but the Gibraltar rock is practically impregnable if properly defended, a carefully planned strategy was the only way to do it. However it was poorly planned and executed even worse. Whilst the Spanish besieged the city by land, the Brits got provisions and ammunition by sea, which is really what they should have stopped.
So after that failed, they tried to conquer an archipelago near the southern tip of Argentina – islands known as Malvinas for the Spanish, and Falklands for the English. They bought if from the French who never knew that there was someone else there, the Engllish. So of course when finally the English and the Spanish found out, there was a imminent conflict over the Falklands. Once again, French intervention (or in this case non intervention) made the difference. For Spain and France had signed a Family Pact, which meant France should have supported Spain. However they didn't make up their minds and Spain ended up giving in as to avoid an actual war.
Apparently the Spanish immersion in war was not over yet. When in 1770's the English colonies in America started to rebel, Spain and France, who held a grudge against England saw the opportunity to get involved and perhaps get back them and also gain some new lands. When the war ended the and the Treaty of Paris was signed. The United States of America got it's independence, but Spain didn't do as well as it hoped. It retook some of its colonies, lost others, but they did not get Gibraltar back, which is one of the things they most wanted. It was pretty much the downfall of the empire. Others would come