Across the municipality evidence of an early settlement abound, the first traces dating back to Neolithic times, five thousand years ago. Inhabited in ancient times by the Iberians, a peaceful agricultural people, Phoenicians, Greeks and Carthaginians arrived in Mértola, occupations driven by control of trade routes. Over time, the history and occupation of Mértola have been determined by its position at the limit of navigability of the River Guadiana, a location vital for Mediterranean trade routes. In addition to this factor, its strategic position at the top of a hill circled by the River Guadiana and the River Oeiras provided excellent natural defences.
The Romanization of Mértola took place throughout the 2nd century BC, with actual occupation of the territory taking place in the second half of that century. Called Iulia Myrtilis or Myrtilis Iulia, testament to the importance of the city and its business at that time is provided by the statuary, written sources, coins, and multiple archaeological finds located in the village over the years. In Late Antiquity, Myrtilis maintained its economic importance and its commercial function. The first Christian evangelists arrive and the religious architecture of the period bears witness to the building of early Christian constructions, exemplified by the Rossio do Carmo Paleochristian Basilica. The military upheavals that shook the Roman Empire created situations of insecurity and instability in the city. Traces of Visigothic communities can be seen in the municipality, as shown by the archaeological finds currently uncovered in the Keep of Mértola Castle.
With the invasion of the peoples of North Africa, led by Tarik in 711, Mértola reaffirms its commercial function and enhances its status as the westernmost port of the Mediterranean. The Christian conquest occurred during the reign of D. Sancho II, by the Commander of the Order of Santiago, Paio Peres Correia, in 1238. The land was then donated to the Order of the Knights of Santiago and gradually lost its commercial importance. In 1512, D. Manuel I gives Mértola a Foral (charter) and during the sixteenth and seventeenth centuries, the port again became important for the export of grain to the Portuguese territories in North Africa.
At the end of the nineteenth century, the discovery and exploration of lode mining in the Serra de Sancto Domingos breathed new life into the lands of Mértola. The population grew significantly over the 112 years of activity, with approximately 25 million tons of ore (mainly copper) being extracted from the subsoil.
With the decline of mining, the municipality experienced a massive population exodus between 1961 and 1971, losing more than 50% of its population, who would never return.
In the eighties, intense archaeological activity revealed all the great past of the village, bearing witness to the vast heritage discovered in successive excavations throughout the municipality. Mértola is called a Museum Village, and the history of a remote past has become a factor in its development and set the tone for a renewed belief in the future.