a bit of proper planning might have helped. they counted on living off the land, and when Portugal went scorched earth combined with them getting bogged down, the Spanish were caught without supplies. having more competent leadership would have helped, too.
I've often wondered what was to be gained if they did succeed. It wasn't going to win the war against Britain. I wonder how much Britain would return to Spain in exchange for something that wasn't theirs. At that point in the war, France was ready to call it quits, and OTL had to buy off Spain with Louisiana to convince Spain to call it quits.