Eryngium viviparum (Apiaceae) is an endangered aquatic plant, listed as threatened in several European documents. The genotypes are distributed patchily in various wetlands in the north-west of Spain and one is located in north-west France. The study of the genetic diversity of a small population of a rare species is important for conservation and studies aimed at recovery programmes. Random amplified polymorphic DNA (RAPD) markers were used to assess the genetic diversity among five Spanish and one French genotype. This technique has contributed to the knowledge of the genetic diversity in E. viviparum, showing a greater genetic distance between the Spanish cluster formed by S1, S4 than the second cluster formed by S2, S3, S5 and the French genotype. Mantel testing did not show a significant correlation between genetic and geographical distances, but a significant correlation was found between altitude, habitat and genetic distance. The French genotype showed the highest level of polymorphism (28.16) and the highest percentage of exclusive markers (32%). One of these was isolated, purified, cloned and sequenced, revealing a high homology to a protein mainly expressed in roots. This could represent, for the F genotype, an adaptation to a specific habitat near the sea compared with the Spanish genotypes which grow inland.