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.
Spanish language
Spanish is the official or national language in Spain, Equatorial Guinea, and 19 countries in the Americas. Speakers in the Americas total some 418 million. It is also an optional language in the Philippines as it was a Spanish colony from 1569 to 1899. In the European Union, Spanish is the mother tongue of 8% of the population, with an additional 7% speaking it as a second language. Spanish is the most popular second language learned in the United States. In 2011 it was estimated by the American Community Survey that of the 55 million Hispanic United States residents who are five years of age and over, 38 million speak Spanish at home.