In order to examine genetic variation and population structure of the widespread lichen-forming ascomycete Xanthoria parietina from similar habitats, but different sites in Scandinavia, we investigated seven populations in Scania, southernmost Sweden, and compared the results with a corresponding study on Storfosna, central Norway. Sequence variations of the nuclear ribosomal DNA were used as molecular markers, for both a part of the IGS region and the complete ITS1-5.8S-ITS2 region. The amount of genetic variability observed was comparable in the two investigations. Divergence between populations in different habitats found in the previous study was also present in this study. Xanthoria parietina is genetically differentiated between habitats with no evidence of restricted gene flow between populations in the same habitat at the present spatial scale, at least at sites along the coast of Scandinavia. Differentiation between habitats is considerable at both study sites, which we attribute to restricted gene flow between habitats, i.e. habitat isolation.