Integrating Roy with Becker, this paper studies occupational choice and matching in the labor market. Our model generates occupation earnings distributions which are right skewed, have firm fixed effects, and large changes in aggregate earnings inequality without significant changes in within firm inequality. The estimated model fits the earnings distribution both across and within firms in Brazil in 1999. It shows that the recent decrease in aggregate Brazilian earnings inequality is largely due to the increase in her educational attainment over the same years. A simulation of skilled biased technical change in the model also qualitatively fits the recent changes in earnings inequality in the United States.