Portuguese developed in the Western Iberian Peninsula from the spoken Latin language brought there by Roman soldiers and colonists starting in the 3rd century BC. The language began to differentiate itself from other Romance languages after the fall of the Roman Empire and the barbarian invasions in the 5th century. It started to be used in written documents around the 9th century, and by the 15th century it had become a mature language with a rich literature.
Arriving on the Iberian Peninsula in 218 BC, the Romans brought with them the Roman people's language, Vulgar Latin, from which all Romance languages (also known as "New Latin Languages") descend. Already in the 2nd century BC southern Lusitania was Romanized. Strabo, a 1st-century Greek geographer, comments in one of the books of his Geographia "encyclopedia": "they have adopted the Roman customs, and they no longer remember their own language." The language was spread by arriving Roman soldiers, settlers and merchants, who built Roman cities mostly near previous civilizations' settlements.
Between 409 A.D. and 711, as the Roman Empire was collapsing, the Iberian Peninsula was invaded by peoples of Germanic origin, known to the Romans as Barbarians. The Barbarians (mainly Suevi and Visigoths) largely absorbed the Roman culture and language of the peninsula; however, Lusitania's language and culture were free to evolve on their own during the Early Middle Ages, due to the lack of Roman schools and administration, Lusitania's relative isolation from the rest of Europe, and changes in the political boundaries of the Iberian peninsula. These changes led to the formation of what is now called "Lusitanian Romance". From 711, with the Moorish invasion of the Peninsula, Arabic was adopted as the administrative language in the conquered regions. However, the population continued to speak their Romance dialects so that when the Moors were overthrown, the influence that they had exerted on the language was small. Its main effect was in the lexicon.
The earliest surviving records of a distinctively Portuguese language are administrative documents from the ninth century, still interspersed with many phrases in Latin. Today this phase is known as "Proto-Portuguese" (spoken in the period between the 9th to the 12th century).
Portugal was formally recognized by the Kingdom of Leon as an independent country in 1143, with King Afonso Henriques. In the first period of "Old Portuguese" - Portuguese-Galician Period (from the 12th to the 14th century) - the language gradually came into general use. Previously it had mostly been used on the Christian Iberian Peninsula as a language for poetry. In 1290, king Denis created the first Portuguese University in Lisbon (the Estudo Geral) and decreed that Portuguese, then simply called the "Vulgar language" should be known as the Portuguese language and should be officially used.
In the second period of "Old Portuguese", from the 14th to the 16th century, with the Portuguese discoveries, the Portuguese language spread to many regions of Asia, Africa and The Americas (nowadays, most of the Portuguese speakers live in Brazil, in South America). By the 16th century it 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. The spreading of the language was helped by mixed marriages between Portuguese and local people (also very common in other areas of the world) and its association with the Catholic missionary efforts, which led to it being called Cristão ("Christian") in many places in Asia. The Nippo jisho, a Japanese-Portuguese dictionary written in 1603, was a product of Jesuit missionary activity in Japan. 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 language has largely changed in these communities and has evolved through the centuries into several Portuguese creoles, some still existing today, after hundreds of years of isolation. A considerable number of words of Portuguese origin are also found in Tetum. Portuguese words entered the lexicons of many other languages, such as Japanese, Indonesian, Malay, or Swahili.
The end of "Old Portuguese" was marked by the publication of the Cancioneiro Geral de Garcia de Resende, in 1516. The period of "Modern Portuguese" (spanning from the 16th century to present day) saw an increase in the number of words of Classical Latin origin and erudite words of Greek origin borrowed into Portuguese during the Renaissance, which augmented the complexity of the language.