Fluorescent microscopy, one of the most widespread means for visualizing the pore system in geomaterials, always suffers from the random interference of autofluorescence of minerals and other rock matrices and, more importantly, is limited to a certain depth for 3D imaging. Here, two-photon excitation fluorescence microscopy, a novel nonlinear optical mode, is unlocked for imaging of the pore architecture in geomaterials with no background and significantly increased imaging depth by the use of a rare-earth-doped upconversion nanoparticle (NaYF 4 :Yb, Er) as a two-photon excitation probe. The superparamagnetic Fe 3 O 4 nanoparticle is integrated with the NaYF 4 :Yb, Er nanoparticle to make them easily drive into pores under the control of an external magnetic field. The rare-earth-doped upconversion nanoparticle offers a unique anti-Stokes optical property, which can be easily distinguished from autofluorescence (Stokes fluorescence), eliminating background fluorescence from the geomaterial matrix for three typical sediment rocks, such as sandstone, carbonate, and shale. Encouragingly, two-photon excitation fluorescence microscopy catches the upconversion fluorescence emission signal at the depth of 450 μm for a randomly selected sandstone using serial optical sectioning without destroying the rock matrix. Coupled with the rare-earth-doped upconversion nanoparticle as a pore probe, two-photon excitation fluorescence microscopy, using near-infrared light as the incident light instead of UV or visible light, with resulting less sensitivity to adsorption and scattering, as well as hosting the spatial confinement of signal generation with nonlinear excitation, provides a new opportunity for the deep imaging of pore architectures in geological materials.