A novel “off-on” fluorescent probe based on 1, 8-naphthalimide derivative for the detection of Mg2+ in ethanol solution was designed and synthesized. The probe displayed responses to Mg2+ with a fluorescence enhancement at 523 nm, accompanying with a distinct fluorescence change from nearly colorless to bright yellow-green. Besides, the probe showed a rapid detection process (45 s), high fluorescence enhancement (up to 15-fold), a good binding constant (6.17 × 105 M−1) and a low detection limit of Mg2+ (5.01 × 10−8 M). Moreover, density functional theory (DFT) calculations were also performed to support the responding mechanism between the probe and the coordination complex. In addition, the cell cytotoxicity experiments suggested that the probe is nearly non-toxic and the fluorescence scanning microscopic experiments demonstrated that the probe was capable of monitoring at the intracellular Mg2+ level successfully.