While neoclassical theory emphasizes the impact of trade on wage inequality between occupations and sectors, more recent theories of firm heterogeneity point to the impact of trade on wage dispersion within occupations and sectors. Using linked employer-employee data for Brazil, we show that much of overall wage inequality arises within sector-occupations and for workers with similar observable characteristics; this within component is driven by wage dispersion between firms; and wage dispersion between firms is related to firm employment size and trade participation. We then extend the heterogenous-firm model of trade and inequality from Helpman, Itskhoki and Redding (2010) and estimate it with Brazilian data. We show that the estimated model provides a close approximation to the observed distribution of wages and employment. We use the estimated model to undertake counterfactuals, in which we find sizable effects of trade on wage inequality.