A flow injection analysis of Ca2+ and Mg2+ using indirect potentiometric detection in natural waters is proposed, where Ca2+ or Mg2+ are injected into a buffer carrier containing phosphate, resulting in the formation of Ca-3(PO4)(2) or Mg-3(PO4)(2). The consequent reduction in free phosphate in the carrier solution is detected using a metallic cobalt wire electrode. Indirect electrode response was used and the experimental conditions affecting electrode response were optimized. Responses were linear in the concentration range 5 x 10(-4) to 5 x 10(-3) M with a detection limit of 1 x 10(-5) M in 20 mM phosphate buffer at pH 8.0. The relative standard derivation at 1 mM of Ca2+ and Mg2+ were 3.9 and 3.7% (n = 10), respectively. EGTA and 8-hydroxyquinoline were used as the masking agents for Ca2+ and Mg2+, respectively. Concentrations of Ca2+ and Mg2+ in natural waters were successfully determined by the proposed method. (C) 1998 Elsevier Science B.V. All rights reserved.