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.
History of the Spanish language
A similar situation occurred in the American Southwest, including California, Arizona, New Mexico and Texas, where Spaniards, then "criollos" (Tejanos, Californios, etc.) followed by Chicanos (Mexican Americans) and later Mexican immigrants, kept the Spanish language alive before, during and after the American appropriation of those territories following the Mexican–American War. Spanish continues to be used by millions of citizens and immigrants to the United States from Spanish-speaking countries of the Americas (for example, many Cubans arrived in Miami, Florida, beginning with the Cuban Revolution in 1959, and followed by other Latin American groups; the local majority is now Spanish-speaking). Spanish is now treated as the country's "second language," and over 5 percent of the U.S. population are Spanish-speaking, but most Latino/Hispanic Americans are bilingual or also regularly speak English.