Catalonia, like all European nations started about a thousand years ago and, for all practical purposes, can be considered as an independent country until the beginning of the 18th century.
So, what is the real meaning of the word Spain?
This is a very hard question to answer in a few words and so my answer will necessarily be an over-simplification of a much more complex situation. It turns out that the idea of a nation-state called Spain evolved slowly when one of the kingdoms in the Iberian peninsula (Castile) wanted to put all other kingdoms under a unique king, a unique law, a unique language, and a unique administration. Clearly, this project could not be completed without violence, intimidation and war. After the defeat of the Catalan army in 1714, Catalonia was incorporated to Spain like a colony.
It should be noticed that the first time that the words "King of Spain" appear in any Spanish constitution is in 1876.