Shanxi Province is currently in the critical period of sustainability transition. Scientifically assessing the current status of water ecological security is conducive to socio-economic development and ecological civilization construction, which in turn can provide strong water support for sustainability transition. We established an assessment system based on the “pressure-state-function-response” (PSFR) model. Then the coefficient of variation method, coupling coordination degree model and grey relational model were combined to investigate the spatio-temporal pattern evolution characteristics and influencing factors of water ecological security in Shanxi Province from 2007 to 2021, from aspects of water ecological pressure, water ecological state, water ecological function and water ecological response. Meanwhile, back propagation (BP) neural network model was used to conduct the early warning analysis of water ecological security in Shanxi Province. The results show that the comprehensive index of water ecological security in Shanxi Province has increased from 0.294 9 to 0.738 4, and the south-central region is superior to the northern region from spatial perspective. The comprehensive index of each subsystem shows a fluctuating upward trend, and the degree of coupling coordination has improved from quasi-coordination to good coordination, with the central region better than the southern and northern regions. The main influencing factors of water ecological security are NDVI, proportion of agricultural water use and so on. The province’s water ecological security level will be in a safe condition from 2022 to 2030. The research results can provide a theoretical support for the development of sustainability transition, as well as management of water ecological security and ecological environment in Shanxi Province.