What accounts for differences in the extent of nationalist sentiments across countries and over time? One prominent argument is that greater economic inequality prompts states to generate more nationalism as a diversion that discourages their citizens from recognizing economic inequality and mobilizing against it. This article provides a first empirical test of this theory against rival explanations based on international conflict and the development of new nations using survey data on national pride in the advanced democracies over two decades, data on economic inequality from the Luxembourg Income Study, and data on international conflict from the Correlates of War project. Only the diversionary theory of nationalism is supported. This conclusion is an important contribution to our understanding of nationalism as well as of the effects of economic inequality on society.