Inorganic pyrophosphate (PPi), as a biologically active anion, is closely related to physiological activities and several pathological changes. Here, we reported a luminescent nanoprobe for the detection and imaging of PPi in vivo based on lanthanide nanoparticles with luminescence at the second near-infrared window modified by the tannic acid and Fe3+ complex. A light-harvesting complex was formed after the coordination of colorless tannic acid with Fe3+ and the luminescence of the nanoparticles was quenched through the inner-filter effect. In the presence of PPi, the complex was decomposed due to the stronger coordination affinity of PPi to Fe3+; thus the luminescence of the nanoprobe was recovered. The nanoprobe manifested good linearity with a low detection limit of 3.36 μM. Importantly, in the in vivo study simulating the calcium pyrophosphate deposition disease, the nanoprobe with the second near-infrared luminescence achieved the imaging of the injected PPi at the paw of the mice at a dose of 0.25 mg kg-1. The reported nanoprobe can serve as a convenient tool for the in vivo imaging of PPi and the diagnosis of PPi-related diseases.