Photodynamic therapy (PDT) is an excellent therapeutic modality for various malignant and nonmalignant cancers. This approach utilizes reactive oxygen species generated through the reaction between photosensitizer and oxygen in tissues upon light irradiation to achieve effective treatment. However, limited penetration depth and oxygen-deficient microenvironment hinder the efficiency of PDT. In this work, we design a multifunctional near-infrared (NIR)-triggered theranostic agent based on upconversion–nanoparticles-Polyoxyethylene bis (amine)–trismethylpyridylporphyrin–fullerene nanocomposite (UCNP–PEG–FA/PC70) for imaging (fluorescence/upconversion luminescence/magnetic resonance imaging)-guided photodynamic therapy. In this multimodal nanocompsite, UCNPs are employed as light transducers to convert NIR light into ultraviolet–visible light to activate PC70 to generate singlet oxygen (1O2) even under low-oxygen conditions. Meanwhile, the upconversion emission, magnetic resonance imaging and fluorescence signal coming from UCNPs and PC70 nanocomposite enable UCNP–PEG–FA/PC70 to act as a multimodal imaging diagnostic agent, which facilitates the imaging-guided PDT. Furthermore, folate-mediated active targeting would enhance the accumulation of multifunctional hybrid in tumor. In vitro as well as in vivo results suggest that this smart nanocomposite is promising as an NIR light-triggered and -targeted theranostic platform for imaging-guided PDT of cancer, which may provide a solution to the bottleneck problems of PDT, namely, limited penetration depth and oxygen-deficient microenvironment. A multifunctional near-infrared-triggered nanocomposite has been demonstrated that is promising for diagnosing and treating tumours. Photodynamic therapy agents destroy cancer cells by generating reactive oxygen species when excited by light but suffer from limited penetration depths and reduced performance in the low-oxygen microenvironments near tumours. Now, scientists in China have developed a three-component nanocomposite consisting of upconversion nanoparticles, trismethylpyridylporphyrin and fullerene that has the potential to overcome both shortcomings. When excited by near-infrared radiation, the upconversion nanoparticles generate ultraviolet and visible light that induces trismethylpyridylporphyrin-fullerene to produce reactive oxygen species for killing tumours. Furthermore, the composite permits three imaging modalities for diagnosis and guiding therapy: fluorescence, upconversion luminescence and magnetic resonance imaging. Finally, folate-mediated active targeting combined with the enhanced permeability and retention effect enhances accumulation of the nanoparticles in tumours. The as-prepared multifunctional upconversion–nanoparticles–trismethylpyridylporphyrin–fullerene nanocomposite (UCNP–PEG–FA/PC70) nanocomposite not only could utilize UCNPs to convert NIR light to ultraviolet–visible one to activate PC70 producing 1O2 for killing cancer cells under low-oxygen conditions, but also could act as a theranostic agent for trimodal fluorescence/upconversion luminescence/magnetic resonance imaging-guided photodynamic therapy (PDT). The synthesized UCNP–PEG–FA/PC70 would pave the way of efficient PDT, namely, limited penetration depth and oxygen-deficient microenvironment, which hinder the efficiency of PDT.