This paper develops a framework for studying the general equilibrium effects of endogenous quality upgrading, a new margin of trade, on the welfare impact of trade liberalization. The theoretical model introduces product quality differentiation amongst heterogeneous firms and focuses on supply-side determinants of international trade. Among other results, in general equilibrium, trade liberalization decreases the share of high-quality varieties in exports and the average productivity of exporters. These changes affect average export price in opposite ways. Nevertheless, trade liberalization in the quality-extended model increases consumers' welfare by more than in the benchmark model.