The first European to colonize Brazil was Pedro Álvares Cabral on April 22, 1500 under the sponsorship of Portugal. From the 16th to the early 19th century, Brazil was a colony of Portugal. The country expanded south along the coast and west along the Amazon and other inland rivers from the original 15 donatary captaincy colonies established on the northeast Atlantic coast east of the Tordesillas Line of 1494 (approximately the 46th meridian west) that divided the Portuguese domain to the east from the Spanish domain to the west. Most of the country's borders were set by the end of the colonial period early in the 20th century.
On September 7, 1822, the country declared its independence from Portugal and became its own country. A military coup in 1889 established a republican government. The country has seen a dictatorship (1930–1934 and 1937–1945) and a period of military rule (1964–1985).