Wild aromatic plants present high intra- and inter-population chemical polymorphisms which are of great ecological and economic interest; however, the factors influencing the phytochemical diversity of aromatic plants remain still unexplored for many species. Here, Teucrium marum L. (Lamiaceae) has been studied, a plant endemic to the western Mediterranean islands, very well-known from the phytochemical point of view but scarcely investigated regarding the ecological factors that influence its phytochemical diversity within and among populations. The specific aims were to: 1) define the chemical composition variability of its essential oils; 2) determine its inter- and intra-population chemical variability; and 3) evaluate whether the elevation, climatic factors and/or the soil substrate determined the phytochemical variability of T. marum along a gradient from coastal to mountain wild populations on the island of Sardinia (Italy). Fresh T. marum aerial parts were randomly collected from ten individuals in six different localities in Sardinia: three coastal and three mountainous. Dried leaf samples were hydrodistillated using a classical Clevenger apparatus to obtain the corresponding essential oils. The composition of each essential oil was chemically characterised and analyzed by gas chromatography coupled to mass spectrometry. Ninety compounds were identified: among the others, the two compounds that mainly characterised the essential oils of the studied populations, dolichodial and (E)-β-caryophyllene, are of great economic interest. Statistical analyses showed significant differences in phytochemical essential oil composition among and within the studied populations, which clustered following a geographical pattern rather than a simple climatic or edaphic grouping. Taken together the results here shown shed light on the environmental and geographical conditions that determine the chemical variability of essential oils in T. marum, highlighting a clear coastal vs mountain clustering, which has an ecological and economic relevance, especially for the potential utilization of dolichodial as an environmental-friendly insecticide.