Seagrass meadows provide important ecosystem services and are critical for the survival of the associated invertebrate community. However, they are threatened worldwide by human-driven environmental change. Understanding the seagrasses' potential for adaptation is critical to assess not only their ability to persist under future global change scenarios, but also to assess the persistence of the associated communities. Here we screened a wild population of Posidonia oceanica, an endemic long-lived seagrass in the Mediterranean Sea, for genes that may be target of environmental selection, using an outlier and a genome-wide transcriptome analysis. We identified loci where polymorphism or differential expression was associated with either a latitudinal or a bathymetric gradient, as well as with both gradients in an effort to identify loci associated with temperature and light. We found the candidate genes underlying growth and immunity to be divergent between populations adapted to different latitudes and/or depths, providing evidence for local adaptation. Furthermore, we found evidence of reduced gene flow among populations including adjacent populations. Reduced gene flow, combined with low sexual recombination, small effective population size, and long generation time of P. oceanica raises concerns for the long-term persistence of this species, especially in the face of rapid environmental change driven by human activities.