Salt stress is a major constraint on cowpea cultivation in semi-arid regions, primarily due to excess salts in irrigation water and soils. We aimed to investigate the effects of foliar magnesium (Mg) application on the production, phenology, and seed vigor of the cowpea landraces "Pingo de Ouro" and "Costela de Vaca" under salt stress conditions. Two experiments were conducted. The first was carried out in a greenhouse using a randomized block design with five replicates, in a 2 x 3 x 4 factorial scheme: two cowpea landraces ("Pingo de Ouro" and "Costela de Vaca"), three irrigation water salinity levels (0.54, 3.50, and 5.00 dS m-1), and four foliar doses of a product (0.0, 1.0, 2.0 and 3.0 mL L-1) containing 8% magnesium. Morphological traits and seed production were evaluated. The second experiment was conducted in a laboratory using a completely randomized design, also in a 2 x 3 x 4 factorial, with four replicates of 25 seeds each. In the first experiment, the 1 mL L-1 dose provided the best results for pod length in the variety "Pingo de Ouro" under an electrical conductivity salinity of 5.00 dS m-1. In the variety "Costela de Vaca", this same dose increased the number of seeds per pod and the 100-seed weight under the same salinity level. In the second experiment, seedlings of "Pingo de Ouro" grown from seeds produced by plants treated with 2 and 3 mL L-1 doses showed greater shoot length, root length, stem diameter, and shoot fresh mass, particularly under 0.54 dS m-1 salinity. Therefore, "Pingo de Ouro" exhibited superior seedling growth at doses of 2 and 3 mL L-1, particularly under conditions of low salinity. These findings support the use of foliar magnesium fertilization as an effective agronomic strategy to enhance seed production and quality in cowpea landraces under salt stress conditions.