When the Romans arrived at the Iberian Peninsula in 216 B.C., they brought the Latin language with them, from which all Romance languages descend. The language was spread by Roman soldiers, settlers, and merchants, who built Roman cities mostly near the settlements of previous Celtic or Celtiberian civilizations established long before the Roman arrivals.
Between 409 A.D. and 711 A.D., as the Roman Empire collapsed in Western Europe, the Iberian Peninsula was conquered by Germanic peoples of the Migration Period. The occupiers, mainly Suebi and Visigoths who originally spoke Germanic languages, quickly adopted late Roman culture and the Vulgar Latin dialects of the peninsula and over the next 300 years totally integrated into the local populations. After the Moorish invasion beginning in 711, Arabic became the administrative and common language in the conquered regions, but most of the remaining Christian population continued to speak a form of Romance commonly known as Mozarabic, which lasted three centuries longer in Spain.
Portuguese evolved from the medieval language, known today by linguists as Galician-Portuguese, Old Portuguese or Old Galician, of the northwestern medieval Kingdom of Galicia. It is in Latin administrative documents of the 9th century that written Galician-Portuguese words and phrases are first recorded. This phase is known as Proto-Portuguese, which lasted from the 9th century until the 12th-century independence of the County of Portugal from the Kingdom of León, by then reigning over Galicia.
In the first part of the Galician-Portuguese period (from the 12th to the 14th century), the language was increasingly used for documents and other written forms. For some time, it was the language of preference for lyric poetry in Christian Hispania, much as Occitan was the language of the poetry of the troubadours in France. Portugal became an independent kingdom in 1139, under King Afonso I of Portugal. In 1290, King Denis of Portugal created the first Portuguese university in Lisbon (the Estudos Gerais, which later moved to Coimbra) and decreed for Portuguese, then simply called the "common language", to be known as the Portuguese language and used officially.
In the second period of Old Portuguese, in the 15th and 16th centuries, with the Portuguese discoveries, the language was taken to many regions of Africa, Asia, and the Americas. By the mid-16th century, Portuguese had become a lingua franca in Asia and Africa, used not only for colonial administration and trade but also for communication between local officials and Europeans of all nationalities.
Its spread was helped by mixed marriages between Portuguese and local people and by its association with Roman Catholic missionary efforts, which led to the formation of creole languages such as that called Kristang in many parts of Asia (from the word cristão, "Christian"). The language continued to be popular in parts of Asia until the 19th century. Some Portuguese-speaking Christian communities in India, Sri Lanka, Malaysia, and Indonesia preserved their language even after they were isolated from Portugal.
The end of the Old Portuguese period was marked by the publication of the Cancioneiro Geral by Garcia de Resende, in 1516. The early times of Modern Portuguese, which spans the period from the 16th century to the present day, were characterized by an increase in the number of learned words borrowed from Classical Latin and Classical Greek because of the Renaissance (learned words borrowed from Latin also came from Renaissance Latin, the form of Latin during that time), which greatly enriched the lexicon. Most literate Portuguese speakers were also literate in Latin; and thus they easily adopted Latin words into their writing—and eventually speech—in Portuguese.
Spanish author Miguel de Cervantes once called Portuguese "the sweet and gracious language", while the Brazilian poet Olavo Bilac described it as a última flor do Lácio, inculta e bela ("the last flower of Latium, rustic and beautiful"). Portuguese is also termed "the language of Camões", after Luís Vaz de Camões, one of the greatest literary figures in the Portuguese language and author of the Portuguese epic poem Os Lusíadas.
In March 2006, the Museum of the Portuguese Language, an interactive museum about the Portuguese language, was founded in São Paulo, Brazil, the city with the greatest number of Portuguese language speakers in the world. The museum is the first of its kind in the world. In 2015 the museum was destroyed in a fire, but there are plans to reconstruct it.