The Atlantic herring (Clupea harengus) is one of the most abundant vertebrates on earth and constitutes a huge biomass in the North Atlantic. We have generated a high-quality draft assembly of the herring genome and carried out whole genome sequencing of more than 20 pooled populations samples (50 fish in each) and of individual fish from certain localities. The results revealed nearly identical allele frequencies among subpopulations in the East Atlantic implying minute amount of genetic drift and possibly gene flow between subpopulations. However, highly significant differentiation at 1-2% of all SNPs was found. We identified almost 500 independent loci associated with a recent niche expansion from marine (Atlantic Ocean) to brackish waters (Baltic Sea), and more than 100 independent loci showing genetic differentiation between spring- and autumn-spawning populations. Interestingly, autumn-spawning Baltic herring from the Baltic Sea show extensive haplotype sharing with a spring-spawning Baltic herring at loci associated with adaptation to the Baltic Sea but extensive haplotype sharing with autumn-spawning Atlantic herring from the North Sea although these has been classified as different subspecies. Thus, different ecotypes of herring carry different combinations of adaptive haplotypes. The results show that both coding and non-coding changes contribute to ecological adaptation. Haplotype blocks, often spanning multiple genes and maintained by selection, are associated with genetic differentiation.