How does the formation of cross-country teams affect the organization of work and the structure of wages? To study this question, we propose a theory of the assignment of heterogeneous agents into hierarchical teams, where less skilled agents specialize in production and more skilled agents specialize in problem solving. We ﬁrst analyze the properties of the competitive equilibrium of the model in a closed economy, and show that the model has a unique and efﬁcient solution. We then study the equilibrium of a two-country model (North and South), where countries differ in their distributions of ability, and in which agents in different countries can join together in teams. We refer to this type of integration as globalization. Globalization leads to better matches for all southern workers but only for the best northern workers. As a result, we show that globalization increases wage inequality among nonmanagers in the South, but not necessarily in the North. We also study how globalization affects the size distribution of ﬁrms and the patterns of consumption and trade in the global economy.