• A new near-infrared fluorescent probe was designed and synthesized. • The fluorescent probe could detect Al 3+ , Cr 3+ , Fe 3+ and Cu 2+ with high selectivity and sensitivity. • Quantum chemical calculations were employed to explain the sensing mechanism. A novel near-infrared (NIR) fluorescence sensor DCM-PSI based on dicyanomethylene-4H-pyran( DCM ) was designed and synthesized to selectively detect Al 3+ , Cr 3+ , Fe 3+ and Cu 2+ . It had a large Stokes shift ( λ abs =450 nm, λ ex =490 nm, λ em =690 nm), low detection limits and large binding constants. With the addition of Al 3+ , Cr 3+ , Fe 3+ and Cu 2+ , the fluorescence quenched and the emission peaks blue shifted to different extent. Experimental analysis and quantum chemical calculations showed that the luminescence of DCM-PSI experienced an excited state intramolecular proton transfer (ESIPT) and partly intramolecular charge transfer (ICT) process, while the complexation of Al 3+ , Cr 3+ , Fe 3+ and Cu 2+ caused ligand-to-metal electron transfer, and altered the “push-pull” effect in DCM-PSI . Furthermore, the Al 3+ and Fe 3+ in drinking water was also measured with DCM-PSI to test the practical application of the sensor.