It existed as a unified kingdom from 1492. A kingdom occupied the same place in international relations and national identity back then that modern nation-states occupy today.
Just want to nitpick everyone. Spain, less Navarre and Portugal, would have existed as a state at that time, but probably not yet a nation, as I presume the people still saw themselves as Aragonese, etcetera, and not yet Spanish. They even spoke different dialects at the time.
Just to nitpick your nitpick, much of Spain still speaks different dialects (if not different languages entirely). So speaking Catalan is a different thing than speaking Galician, which is very different than the Basque language. There's also Andalusian and the Canarian dialect, among others I probably don't know about.