This study aims to explore the role of spatial heterogeneity in ridership analysis and examine the relationship between built environment, station attributes and urban rapid transit ridership at the station level. Although spatial heterogeneity has been widely acknowledged in spatial data analysis, it has been rarely considered in travel behavior studies. Four models (three global models-ordinary least squares (OLS), spatial lag model (SLM), spatial error model (SEM) and one local model-geographically weighted regression (GWR) model) are estimated separately to explore the relationship between various independent variables and station ridership, and identify the influence of spatial heterogeneity. Using the data of built environment and station characteristics, the results of diagnostic identify evidence the existence of spatial heterogeneity in station ridership for the metro network in Nanjing, China. Results of comparing the various goodness-of-fit indicators show that, the GWR model yields the best fit of the data, performance followed by the SEM, SLM and OLS model. The results also demonstrate that population, number of lines, number of feeder buses, number of exits, road density and proportion residential area have a significant impact on station ridership. Moreover, the study pays special attention to the spatial variation in the coefficients of the independent variables and their statistical significance. It underlines the importance of taking spatial heterogeneity into account in the station ridership analysis and the decision-making in urban planning.