A series of studies have been conducted in recent years to address the academic and policy debate on smart cities, some of which argue that the adoption of smart technologies to manage cities can exacerbate inequalities in urban development by favoring the classes that benefit from this model. However, to date, the links between smart cities and urban inequality (UI) has never been empirically tested at the city level of statistical inference. Therefore, with a combination of the difference-in-difference (DID) model and heterogeneity-robustness estimate, a quasi-natural experiment concerned with China's smart city policy was carried out. The following are the primary conclusions: First, smart city construction alleviates urban inequality. Following several robustness tests, the finding is still reliable. Second, the effect of smart city construction on inequality is heterogeneous. Third, there is a significant positive spatial spillover effect of the impact of smart city construction on inequality. Therefore, it is suggested to formulate targeted smart city development strategies from the following aspects: strengthening the overall planning and strategic layout of smart city projects, focusing on social equity and protecting the interests of vulnerable groups, improving regional cooperation mechanisms, attracting and cultivating innovative talents, giving priority to the impact of heterogeneous cities, and emphasizing the participation and autonomy of grassroots communities, so as to tap the potential of digital technology in sustainable cities and societies.