Marine phytoplankton play essential roles in global primary production and biogeochemical cycles. Yet, the evolutionary genetic underpinnings of phytoplankton adaptation to complex marine and coastal environments, where many environmental variables fluctuate and interact, remain unclear. We combined population genomics data with experimental transcriptomics to investigate the genomic basis underlying a natural evolutionary experiment that has played out over the past 8,000 years in one of the world9s largest brackish water bodies: the colonization of the Baltic Sea by the marine diatom Skeletonema marinoi. To this end, we used a novel approach for protist population genomics, combining target capture of the entire nuclear genome with pooled sequencing, and showed that the method performs well on both cultures and single cells. Genotype-environment association analyses identified >3,000 genes with signals of selection in response to major environmental gradients in the Baltic Sea, which apart from salinity, include marked differences in temperature and nutrient availability. Locally adapted genes were related to diverse metabolic processes, including signal transduction, cell cycle, DNA methylation, and maintenance of homeostasis. The locally adapted genes showed significant overlap with salinity-responsive genes identified in a laboratory common garden experiment, suggesting the Baltic salinity gradient is a major factor driving local adaptation of S. marinoi. Altogether, our data show that local adaptation of phytoplankton to complex coastal environments, which are characterized by a multitude of environmental gradients, is driven by intricate changes in diverse metabolic pathways and functions.