Spanish is an Indo-European language, whose earlier ancestor was spoken 5,000 years ago in the area of the Black Sea.
Later its speakers spread in different directions and the many varieties which derived from that became basically all European languages that are actually spoken – exept for Basque, Finnish, Sami (Lapp) and Magyar (Hungarian) – and the Indian ones in Bangladesh, Assam and in many other territories in between.
Together with other European languages such as Portuguese, French or Italian and because of the linguistic roots that are explained further on, Spanish is defined a Romance language. This means that Latin, or more specifically, Vulgar Latin, constitutes its most important linguistic base.
The constant contact and mutual influence of the Latin basis with other linguistic traditions and cultures has led to the formation of the different Romance languages as we know them today. In the case of Spanish, there are, for example, characteristics that come from the Iberian and Celtic traditions.
As in Latin obviously we find many Greek expressions, of course we can perceive some Greek roots in the Romance languages and among them in modern Spanish. And we should not forget the seven centuries of Arab domination of the peninsula. This has left, among other things, an important lexical heritage that nowadays are part of the Spanish language. An exemple for all could be a surname you probably know: “Almodóvar”, the famous cine director; however, quite in general, all the words that begin with the prefix “al”(which identifies the article “the”) normally come from Arab.
The first known documents to have been written in the Spanish language are the so called “Glosas Emilianenses”. They are commentaries and footnotes written in the Navarroaragonese language during the 10th century next to their original text in Latin. They were found in the Monastery of San Millán de la Cogolla and represent the very first evidence of the modern Spanish.
In the fifteenth century then, with the union of the monarchies of Castilia and Aragon, which extended their dominion over the largest part of the peninsula, the language of Castilia - the castilian, as Spanish is called nowadays - became imposed over the other idioms and dialects and crossed the Atlantic on the ships of discoverers, conquistadors and missionaries in Americas, Federated States of Micronesia, Guam, Marianas, Palau and the Philippines. Actually it was not until 1492 that a published grammar of el castellano appeared, written by Elio Antonio de Nebrija. The year was significant - Columbus's discovery of America and the taking of Granada by the Catholic Kings.
So with the political unification of Castilla and Aragon, el castellano (the castilian) became the language of legal documents, of politics and diplomacy and later on, the year 1611 saw the publication of the first Spanish dictionary, by Sebastian de Covarrubias. Because of the great colonial empire and the importance the Spanish kindom had adquired in those centuries, Spanish became the major diplomatic language until the eighteenth century. The lexicon at this time began to incorporate a large body of words from other languages, both European and Native American, of course due to the mutual influences.