Identifying the genetic drivers of adaptation is a necessary step in understanding the dynamics of rapidly evolving pathogens and cancer. However, signals of selection are obscured by the complex, stochastic nature of evolution. Pervasive effects of genetic linkage, including genetic hitchhiking and clonal interference between beneficial mutants, challenge our ability to distinguish the selective effect of individual mutations. Here we describe a method to infer selection from genetic time series data that systematically resolves the confounding effects of genetic linkage. We applied our method to investigate patterns of selection in intrahost human immunodeficiency virus (HIV)-1 evolution, including a case in an individual who develops broadly neutralizing antibodies (bnAbs). Most variants that arise are observed to have negligible effects on inferred selection at other sites, but a small minority of highly influential variants have strong and far-reaching effects. In particular, we found that accounting for linkage is crucial for estimating selection due to clonal interference between escape mutants and other variants that sweep rapidly through the population. We observed only modest selection for antibody escape, in contrast with strong selection for escape from CD8+ T cell responses. Weak selection for escape from antibody responses may facilitate bnAb development by diversifying the viral population. Our results provide a quantitative description of the evolution of HIV-1 in response to host immunity, including selection on the viral population that accompanies bnAb development. More broadly, our analysis argues for the importance of resolving linkage effects in studies of natural selection.