They won't be automatically in the EU, and actually, this is going to be a serious political problem - the EU will have (rightfully) troubles accepting a country with strong separatist sentiments.
On top of this, it will have very serious financial problems - Catalonia economy may look good in a Spanish context, but compared to the European countries in the mid/upper "class", it's very poor, and will be worse once it will have to pay the administrative bills for setting itself up as a country.
This isn't really a great example, as North and South Carolina weren't really ever a single entity (even when there was a Province of Carolina, North and South Carolina were separate within it). They were both original US states.
E.G: there is a strong racism culture among Catalonia independentists, even against other Spaniards. They even invented part of their cultural heritage to sound more credible (look up their "ancestral cultural dance" origin, it is kinda funny). If you want your independence, not alianating the rest of your neighbors for decades can be a good start.
Those events are never unfolding in an instant, but are the consequences of years of complex shenanigans.
Spain is going to be left with the choice between letting Catalonia go or attempting to use force to keep them in the state. I don't think Spain is prepared to fight a civil war over this, personally, nor should it. Let them go, keep them in the EU, keep the borders open.
With the EU there, it seems like breakups like this don't need to go any worse than splitting up North and South Carolina, for example.