Though activatable DNA nanomachines in response to external and internal stimuli successfully improve the temporal and spatial controllability of biosensing and bioimaging, current strategies usually apply different irradiation lights for DNA nanomachine activation and imaging processes. The involvement of short wavelength excitation results in shallow tissue penetration and high background interference. Here we design a photo-locked DNA nanomachine (P-DNA nanomachine) that uses single NIR irradiation for spatiotemporally activating nanomachine operation and metal ion imaging in cancer cells. Upconversion nanoparticles (UCNPs) are modified with energy collector dye FITC, photo-locked DNAzyme and its substrate strands labelled with BHQ1. Part of the UCNPs emission at 450 nm was collected by FITC and quenched by BHQ1 originally. 980 nm irradiation photolyzes PC linker, activates DNAzyme catalytic reaction in the presence of Zn2+, and recovers FITC luminance at 540 nm. The intracellular Zn2+ amount was imaged by quantitatively measuring FITC recovery intensity versus internal standard of UCNPs luminance at 450 nm. The presented NIR activatable P-DNA nanomachine demonstrates effective protection against “false positive” signal from extracellular interference, thus has potential application for in vivo imaging.