Tourism ecological security (TES) has gradually become a frontier topic because it is related to the virtuous circle of ecosystems and sustainable development, especially in river basins with fragile ecosystems. Based on the Driver–Pressure–State–Impact–Response (DPSIR) model and open systems theory, we constructed a TES evaluation system in the Yellow River Basin (YRB), China. Then, the TES index was measured from 2004 to 2019 and its spatio-temporal characteristics and driving mechanism were analyzed. The results show that: (1) In terms of temporal evolution, the comprehensive TES index shows a steady upward trend, but the difference between cities increases over time. Moreover, the proportion of cities with low status levels of TES declined rapidly, while the proportion of cities with high status levels of TES has grown slowly. (2) Spatially, low-TES value cities have always been in the majority, and the high-value cities show a scattered spatial distribution, most of which are along the river. Moreover, TES is randomly distributed in space before 2013, but it shows a significant positive spatial clustering feature thereafter. Specifically, the range of hot spots extends from the intersection of the middle and upper reaches to downstream, while the cold spots are always scattered. Furthermore, the trend surface in the east–west direction is always smooth, while it gradually manifests an inverted U-shape in the north–south direction. (3) In the dynamic transfer, TES lacks the vitality of transfer, but the probability of shifting upward becomes more significant when adjacent to higher-level cities; the opposite is true when adjacent to lower-ranked cities. (4) In terms of the driving mechanism, the factors related to tourism and the economy are the most important driving forces, and the effect of tourism-related factors on TES is becoming increasingly significant. Moreover, the driving mechanism is constructed. Finally, this study provides targeted policy implications for improving TES in the YRB, which has reference value for the development of ecological protection and high-quality tourism.