Several recent papers use the quantile regression decomposition method of Machado and Mata (2005) to analyze the gender gap in log wages across the distribution. Since employment rates often differ substantially by gender, sample selection is potentially a serious issue for such studies. To address this issue, we extend the Machado-Mata technique to account for selection. In addition, we prove that this procedure yields consistent and asymptotically normal estimates of the quantiles of the counterfactual distribution that it is designed to simulate.We illustrate our approach by analyzing the gender log wage gap between men and women who work full time in the Netherlands. Because the fraction of women working full time in the Netherlands is quite low, this is a case in which sample selection is clearly important. We find a positive selection of women into full-time work and find that about two thirds of this selection is due to observables such as education and experience with the remainder due to unobservables. Our decompositions show that the majority of the gender gap across the log wage distribution is due to differences between men and women in the distributions of returns to labor market characteristics rather than to differences in the distributions of the characteristics themselves.