Divergent selection on ecological traits is thought to be the main driver of ecological speciation, leading directly or indirectly to the evolution of reproductive barriers between populations in different environments without geographic isolation. Low competition in stressful habitats as well as habitat heterogeneity occurring between biotic regimes are factors, which actively promote speciation in higher plants. The relatively young landscape of the Elbe estuary (Northern Germany) provides an excellent opportunity for studying ecological differentiation in species colonizing the newly developing marshes during the postglacial period. Deschampsia wibeliana (Poaceae) is a perennial grass endemic to the Elbe estuary growing in tidal freshwater and oligohaline marshes. Its putative ancestor, D. cespitosa, is a holarctic distributed species, which is common and widespread in Northern Germany and found in moist (non-tidal) habitats. The high morphological similarity between the taxa is accompanied by strict habitat differentiation. Using a combined approach of molecular analyses (AFLP) and a mesocosm experiment with different hydrological regimes (waterlogging, short-term \& long-term tidal flooding), we assessed the genetic and ecological differentiation between the taxa. We asked whether the adaptation of D. wibeliana to tidal flooding might be the result of natural divergent selection on ecological traits. Deschampsia wibeliana and D. cespitosa showed a distinct genetic differentiation in the AFLP analysis. Moreover, differences in the genetic structure among populations between both taxa indicated distinct landscape patterns in gene flow. Moreover, the taxa showed contrasting responses in terms of leaf traits and biomass production towards long-term tidal flooding and waterlogging, indicating adaptation to their respective habitats. There is substantial evidence for an early stage of ecological speciation in the endemic taxon D. wibeliana growing sympatrically with the widely distributed D. cespitosa. The endemism of D. wibeliana is very likely due to an adaptation to high abiotic stress in its habitat (tidal flooding). Our study may present one of the few cases of ecologically driven divergence of a locally adapted narrow neoendemic plant species.