Two large but separate bodies of literature analyze the economic effects of international trade and immigration. Given that several factors are important determinants of both trade and migration flows, the previous studies are vulnerable to a potentially serious omitted-variables bias, questioning the validity of existing estimates of the effects of trade and immigration on income. This paper provides estimates of the effects of trade and immigration on income in a unified framework. We also provide a useful decomposition of the channels at work in terms of the employment rate, the capital intensity, and total factor productivity of the receiving economy. We assemble panel data on immigration flows, output, employment and capital stocks for thirty OECD countries over the period 1980-2007. In order to identify the causal effects of trade and immigration on economic outcomes we adopt and extend the gravity-based approach in Frankel and Romer (1999). Our predictors for trade and immigration flows are based on geography and the demographic trends of each country's trade and migration partners. We find that immigration has a large, positive effect on the employment rate of the receiving country. However, it leaves income per capita unaffected because of an offsetting negative effect on TFP. In contrast, trade flows appear to increase income per capita, mainly through TFP growth, and have no impact on the employment rate. The positive employment effect of immigration is the most robust of all the effects identified in this paper.