Sodium-calcium exchanger (NCX) proteins are ubiquitously expressed and play a pivotal role in cellular calcium homeostasis by mediating uphill calcium efflux across the cell membrane. Intracellular calcium allosterically regulates the exchange activity by binding to two cytoplasmic calcium-binding domains, CBD1 and CBD2. However, the calcium-binding affinities of these domains are seemingly inadequate to sense physiological calcium oscillations. Previously, magnesium binding to either domain was shown to tune their affinity for calcium, bringing it into the physiological range. However, while the magnesium-binding site of CBD2 was identified, the identity of the CBD1 magnesium site remains elusive. Here, using molecular dynamics in combination with differential scanning fluorimetry and mutational analysis, we pinpoint the magnesium-binding site in CBD1. Specifically, among four calcium-binding sites (Ca1-Ca4) in this domain, only Ca1 can accommodate magnesium with an affinity similar to its free intracellular concentration. Moreover, our results provide mechanistic insights into the modulation of the regulatory calcium affinity by magnesium, which allows an adequate NCX activity level throughout varying physiological needs.