Dude, do you even know what 19th century history was like for Spain?
Immediately following Napoleon being kicked out, the new king started purging intellectuals like they had gone out of style, then a mutiny that forced the king to restore the liberal constitution he had previously abolished, followed three years later by a french invasion that restored absolutism, followed by lots more purging and rioting and executions and what-have-you.
This is followed shortly afterwards by a brutal civil war lasting some six years, then a chain-gang of coups and counter-coups.
In short, Spain having the ability to wage meaningful war across the atlantic by the mid 19th century requires nothing short of alien space bat intervention.