Standard Spanish is a linguistic variety, or lect, that is considered a correct educated standard for the Spanish language.
Standard Spanish originated in the medieval Castilian dialect. In 1085, the Castilians conquered the city of Toledo, the traditional old capital of a united peninsular kingdom in the Visigothic era. This city became the main center of the kingdom and the Christian Primate see, and it was there that an increasing new body of documents was written, not in official Latin, but in the local dialect, called castellano (Castilian). So, the written standard of Spanish started developing during the 12th century. The first steps toward standardization of Castilian were taken in the 13th century by King Alfonso X of Castile (Alfonso, the Wise), who assembled scribes and translators at his main court in Toledo. The king supervised the writings or even wrote some documents himself, always trying to make sure that they were written in castellano drecho (correct Castilian). These included extensive works on history, astronomy, law, and other fields of knowledge, either composed originally or translated from Islamic sources. This body of writings contributed to the advancement of knowledge at the newly created universities in Europe that would lead to the early Renaissance forms during the Trecento.
The first grammar of Castilian (or of any modern European language) was published in 1492 by Antonio de Nebrija. Further commentary on the language was offered by Juan de Valdés in 1535. In its earliest documented form, and up through approximately the 15th century, the language used is customarily called Old Spanish. From approximately the 16th century on, it is called Modern Spanish. Because Old Spanish resembles the modern written language to a relatively high degree, a reader of Modern Spanish can learn to read medieval documents without much difficulty. After the settling of the Royal Court at Madrid, from the main one at Toledo and a few others, early in the 1600s the written language used among courtiers of all regional backgrounds in the peninsula was distilled into a common written form, which was finally settled by the Royal Academy in the next century. The Spanish of the 16th and 17th centuries is sometimes called classical Spanish, referring to the literary accomplishments of that period.