Inverse geochemical modelling with PHREEQC and multivariate statistical methods were used to determine the origin of groundwater chemical constituents and identify the source of salinity in parts of Ajabshir alluvial aquifer, East Azerbaijan, Iran. Q mode hierarchical cluster analysis (HCA) was used to partition groundwater in the study area into hydrochemical facies. Three major water groups were identified by HCA. Groundwater samples collected from the study area were classified as recharge area waters (Group 1: Na–Ca–HCO3 water; Group 2: Ca–Na–HCO3 water) in the northern, central and northeastern areas. Discharge area waters were identified in the vicinity of Urmia Lake and in southern parts of the study area (Group 3: Na–Cl water). Principal components analysis (PCA) with varimax rotation using the Kaiser criterion identified three principal sources of variation in the hydrochemistry. Factor 1 accounts for the salinity of the water, factor 2 represents silicate mineral weathering, and factor 3 represents calcite dissolution and incongruent silicate mineral weathering. Inverse modelling for major ions and the results of HCA confirmed the results obtained with PCA. The results of this study showed that water–rock interaction is an important mechanism in the evolution of water chemistry. The results also identified the following phenomena as important mechanisms in the composition of Group 3 waters: saline water upconing, mixing between freshwater and saline water, reverse flow from the salt flats toward the aquifer, flatness of the ground surface and very low velocity of the groundwater, shallow depth of the groundwater and evaporation from it, a silt–clay boundary at the outlet of groundwater flow from the aquifer, and airborne transport of salt particles from the salt flats.