Social media has arguably shifted political agenda-setting power away from mainstream media onto politicians. Current U.S. President Trump’s reliance on Twitter is unprecedented, but the underlying implications for agenda setting are poorly understood. Using the president as a case study, we present evidence suggesting that President Trump’s use of Twitter diverts crucial media (The New York Times and ABC News) from topics that are potentially harmful to him. We find that increased media coverage of the Mueller investigation is immediately followed by Trump tweeting increasingly about unrelated issues. This increased activity, in turn, is followed by a reduction in coverage of the Mueller investigation—a finding that is consistent with the hypothesis that President Trump’s tweets may also successfully divert the media from topics that he considers threatening. The pattern is absent in placebo analyses involving Brexit coverage and several other topics that do not present a political risk to the president. Our results are robust to the inclusion of numerous control variables and examination of several alternative explanations, although the generality of the successful diversion must be established by further investigation.