If this happens during the Civil War, then the U.S. is beat. The best time for the Spanish is 1864, really. U.S. is losing money, economy is hurtng, and Spain comes in to help C.S.A. perhaps in return for something out of the U.S.A. That Chincha Islands thing is good.
I too like this for a POD, but 1864 is late point to consider the war winnable for Dixie, even with Spanish help. Nonetheless, the war would be interesting.
By the way, I think I have an idea about what a Confederate deal with Spain might entail.