Ecological differences often evolve early in speciation as divergent natural selection drives adaptation to distinct ecological niches, leading ultimately to reproductive isolation. Although this process is a major generator of biodiversity, its genetic basis is still poorly understood. Here we investigate the genetic architecture of niche differentiation in a sympatric species pair of threespine stickleback fish by mapping the environment-dependent effects of phenotypic traits on hybrid feeding and performance under semi-natural conditions. We show that multiple, unlinked loci act largely additively to determine position along the major niche axis separating these recently diverged species. We also find that functional mismatch between phenotypic traits reduces the growth of some stickleback hybrids beyond that expected from an intermediate phenotype, suggesting a role for epistasis between the underlying genes. This functional mismatch might lead to hybrid incompatibilities that are analogous to those underlying intrinsic reproductive isolation but depend on the ecological context.