In this research, the effects of decyl glucoside (DG) on the corrosion inhibition and battery performance of Mg–air battery have been investigated. Chemical and electrochemical techniques have been used to evaluate the corrosion rate and inhibitor efficiency. Mg surface has been characterized with scanning electron microscopy (SEM) and infrared spectroscopy (FTIR). A significant reduction in the corrosion rate of Mg in battery electrolyte (3.5% NaCl solution) has been observed in the presence of DG surfactant. Maximum inhibition efficiency (>94%) is achieved at critical micelle concentration of DG surfactant (CMC = 2.5 mM). The presence of DG surfactant increases the activation energy of the corrosion reaction. Physisorption mechanism has been suggested for the inhibition action of DG surfactant. The Mg-air battery containing DG surfactant offers higher operating voltage, discharge capacity and anodic utilization than in its absence.