We document that between 50% and 70% of changes in the US wage structure over the last four decades are accounted for by the relative wage declines of worker groups specialized in routine tasks in industries experiencing rapid automation. We develop a conceptual framework where tasks across a number of industries are allocated to different types of labor and capital. Automation technologies expand the set of tasks performed by capital, displacing certain worker groups from employment opportunities for which they have comparative advantage. This framework yields a simple equation linking wage changes of a demographic group to the task displacement it experiences. We report robust evidence in favor of this relationship and show that regression models incorporating task displacement explain much of the changes in education differentials between 1980 and 2016. Our task displacement variable captures the effects of automation technologies (and to a lesser degree offshoring) rather than those of rising market power, markups or deunionization, which themselves do not appear to play a major role in US wage inequality. We also propose a methodology for evaluating the full general equilibrium effects of task displacement (which include induced changes in industry composition and ripple effects as tasks are reallocated across different groups). Our quantitative evaluation based on this methodology explains how major changes in wage inequality can go hand-in-hand with modest productivity gains.