The Spanish didn't even have the military capabilities to invade the American mainland in any form. The US military complex was already growing into a wild beast. And if the CSA managed to beat the Union army then they'd have just as strong a bear as the Union. the mid 19th century was the time of American transformation into a world power. For the CSA to win, they'd need to be greater. And the Spanish had already basically fallen off the political stage. The only thing left to do for the Americans at this stage was geopolitical projection. Of those powers there are two with the ability to make such an effort: The French and the British. British for obvious reasons, but for the French under Napoleon III they had already executed a successful push into Mexico on failed loan payments by the government of Mexico. At their war's end Napoleon III had successfully named Austrian-born Maximilian I of the House Hapsburg as Emperor of Mexico and his ally in the Americas. The mid-19th century was a big time in political adventurism for France who had as well beaten the Russians in the Crimean War alongside the British not shortly before then. The Spanish however had done nothing. Hell, at this time the Spanish are working to justify their own version of slavery and invading another slave-friendly nation would work against their ideology and political standing. If anything the Spanish would want to befriend the CSA on account of reviving a sort of slave trade in the future I imagine. But even French and British ability to play around in North America I don't think anyone had nearly enough to go to war. Or the power to do so. At this point the Monroe Doctrine would be bust so they'd be back to maybe chipping around the Americas without a Washington to bitch. The British had already replaced their cotton needs with Indian Cotton so the CSA didn't matter to their economy and disputes over slavery - which they were militantly against earlier in the century - is probably superficial at best.