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.
Standard Spanish
Given that a neutral Spanish for all Spanish-speakers is impossible, there are four established standardized "Spanishes" used in translations and, more recently, in film-dubbing by some companies: (1) Castilian or Peninsular Spanish for Spain; (2) River Plate Spanish for Uruguay, Paraguay and Argentina (using "voseo"); (3) Mexican Spanish for the United States, Canada, Mexico, Central America (even though this last region is largely "voseante"), and the rest of Spanish-speaking America); (4) the Spanish of international organisations like the United Nations, the Organisation of American States and their respective specialised bodies. Naturally UN Spanish differs from OAS Spanish, because Spain is not a full member of the latter organisation, and thus its influence is weak. But Spain was refused membership in the UN when it was founded in 1945, since Spain was a dictatorship. Although it remained a dictatorship, it was eventually admitted in 1956. However, by then UN Spanish had already been established by Spanish-American diplomats and translators.