Names given to the Spanish language
Formally speaking, the national language of Spain, the official Spanish language, is the Castilian language (as opposed to regional Spanish languages like Galician, Catalan, Asturleonese and Basque). As such both names, "español" and "castellano", have distinct and independent meanings that may be required for clarity in some specific contexts.
Generally speaking, though, both terms can be used to refer to the (national) Spanish language as a whole, with a preference for one over the other that depends on the context or the speaker's origin. "Castellano" (as well as "Castilian" in English) has another, more restricted, meaning, relating either to the old Romance language spoken in the Kingdom of Castile in the Middle Ages, predecessor of the modern Spanish language, or to the variety of Spanish nowadays spoken in the historical region of Castile, in central Spain.
Principality of Catalonia
Today, Catalan is one of the three official languages of autonomous community of Catalonia, as stated in the Catalan Statute of Autonomy; the other two are Spanish, and Occitan in its Aranese variety. Catalan has no official recognition in "Northern Catalonia". Catalan has official status alongside Spanish in the Balearic Islands and in the Land of Valencia (where it is called "Valencian"), as well as Algherese Catalan alongside Italian in the city of Alghero and in Andorra as the sole official language.