The legendary original home of the Aztecs was called Aztlán, or "place of the seven legendary caves." According to their records, the Aztecs left Aztlán in 1168 A.D. and wandered through much of Mexico until they settled in the Valley of Mexico in the 13th century. The main body of the Aztecs founded the city of Tenochtitlán about 1325; a smaller group founded the city of Tlateloco nearby.

The Aztecs were under the control of more powerful tribes until the reign of Itzcóatl (1428–40). Under his leadership, Tenochtitlán joined nearby towns to overthrow the Tepanecs, who were then dominating the valley. The Aztecs formed an alliance with two of the towns, Texcoco and Tlacopán (now Tacuba) and began to conquer the surrounding territory. Between 1460 and 1519, the Aztecs became the chief power in the alliance and their empire reached its greatest extent. In 1473 Tenochtitlán conquered and annexed Tlateloco.

In 1519 the Aztec Empire was invaded by a small Spanish army led by Hernando Cortez. As the Spaniards marched to the capital, they gained allies among tribes resenting Aztec power. Montezuma II, the Aztec emperor, welcomed Cortez to Tenochtitlán, but was seized as a hostage by the Spaniards.

In the spring of 1520, an army of Spaniards landed in Mexico to arrest Cortez because he had launched his campaign to conquer Mexico without proper authorization. Cortez withdrew his main army from the capital, and went to the coast to meet the threat. The Aztecs revolted against the small force that had been left in Tenochtitlán. Cortez was able to seize the officers of the army that had been sent against him and gain the allegiance of most of the soldiers. He then returned to Tenochtitlán with his army, but was unable to quell the uprising. When Montezuma tried to calm his people, they attacked him with stones and arrows. He died soon afterwards. ( On June 30, 1520, the "dismal night," the Spaniards retreated to the mainland, losing about half their number to fierce Aztec attacks.

Montezuma was succeeded in turn by a brother and a nephew. In May, 1521, Cortez returned with reinforcements and laid siege to the capital. He used a small fleet of boats, constructed with the help of Indian allies, to clear the lake of canoes while the army advanced along the causeways. For three months the Aztecs, led by their emperor Cuauhtémoc (or Guatemotzin), fiercely defended the city. Finally, weakened by starvation and plague, they surrendered on August 13, 1521.

The Spaniards tore down the buildings and filled in the canals, completely destroying the city. They built Mexico City on its ruins and began to develop the territory as a colony. During the 16th century, the Indians were protected from abuse by special laws enacted by the Spanish government. Missionaries educated and Christianized many natives. Gradually, however, the Spaniards reduced the Indians to serfdom. Many lost their lands and were forced to work in mines. Others died of tuberculosis, measles, and smallpox.