The ocean is the largest sink for anthropogenic carbon dioxide (CO2), having absorbed roughly 40 per cent of CO2 emissions since the beginning of the industrial era1,2. Recent data show that oceanic CO2 uptake rates have been growing over the past decade3,4,5,6,7, reversing a trend of stagnant or declining carbon uptake during the 1990s8,9,10,11,12,13,14. Here we show that ocean circulation variability is the primary driver of these changes in oceanic CO2 uptake over the past several decades. We use a global inverse model to quantify the mean ocean circulation during the 1980s, 1990s and 2000s, and then estimate the impact of decadal circulation changes on the oceanic CO2 sink using a carbon cycling model. We find that during the 1990s an enhanced upper-ocean overturning circulation drove increased outgassing of natural CO2, thus weakening the global CO2 sink. This trend reversed during the 2000s as the overturning circulation weakened. Continued weakening of the upper-ocean overturning is likely to strengthen the CO2 sink in the near future by trapping natural CO2 in the deep ocean, but ultimately may limit oceanic uptake of anthropogenic CO2.