Urban water ecology has important ecological functions, such as urban ecological security, pollution purification and rain-flood regulation. Enhancing urban water ecological resilience (UWER) is a key approach to advancing urban water ecological governance, and a water resource tax (WRT) is an important measure for protecting the water ecological environment. On the basis of data from 264 prefecture-level cities and above from 2009 to 2021, this paper constructs an indicator to measure UWER and analyzes the impact of a WRT on UWER via the time-varying DID model. The study reveals that the implementation of a WRT significantly enhances UWER, but the effect shows diminishing marginal returns and insignificant long-term effects. However, spatial analysis indicates that a WRT has a positive spatial spillover effect on urban water ecology, enhancing the UWER of surrounding cities. Additionally, the heterogeneity analysis of different cities indicates that a WRT has a notably stronger impact on cities located on provincial borders, resource-based cities and small- to medium-sized cities. This study provides a new perspective on improving UWER and offers important references for further improving WRT policies.