By about 1000 A.D., the indigenous San (Bushmen) and Khoi (Hottentots) had been largely replaced by Bantus. Arab merchants traded in Mozambique for ivory, slaves, and gold at an early date. In 1498, Vasco da Gama, a Portuguese explorer, visited the area. The Portuguese built fortified posts along the coast and penetrated inland along the Zambezi River. Large estates iprazos) were established, mainly by traders dealing in gold and slaves. They were virtually independent of Portuguese authority. Slavery was an important source of income until it was abolished in the 19th century. Native uprisings against the Portuguese were frequent throughout the colonial period.

Portugal explored much of the interior, but by the mid-19th century held effective control over only a few coastal and river locations. In the late 1800's, vast areas of Mozambique, also called Portuguese East Africa, were given to private companies for economic development. The last private company charter expired in 1941. Rebellion against Portuguese rule broke out in 1964. It was led by the Mozambique Liberation Front (Frelimo). Prolonged warfare in Mozambique and other Portuguese colonies helped to cause the fall of the government of Portugal in 1974. The new Portuguese government granted Mozambique independence in 1975. Frelimo's leader, Samora Machel, became the country's first president.

Machel established a radical socialist regime aligned with the Communist bloc. Private businesses, including farms and plantations, factories, and retail stores, were nationalized. Most of the Portuguese settlers left the country, and this loss of trained manpower, combined with the inexperience of government officials in operating businesses, severely set back Mozambique's economy. The country was also troubled by persistent guerrilla resistance by a right-wing organization, Renamo.

In 1980, Machel began establishing diplomatic and trading ties with the West and began moderating socialist policies to allow free enterprise. Machel died in an airplane crash in 1986. His successor, Joaquim Chissano, made a peace agreement with Renamo in 1992. He also adopted a democratic, nonsocialist constitution, in 1990; in 1994 Chissano won the country's first multiparty elections. He was reelected president in 1999.

In 2000, Cyclone Eline hit Mozambique. It killed about 700 people, caused widespread flooding, and left about 500,000 people homeless. Mozambique again experienced severe flooding in 2001, which killed around 100 people and left more than 200,000 homeless. Armando Guebuza of the ruling Frelimo party won the presidential election in 2004. He was reelected in 2009.