Achieving both deep penetration of photons into biological tissue and highly sensitive recording of optical probes' response are the key goals of non-invasive optical imaging. In comparison with the traditional fluorescence imaging in the visible (400–700 nm) and near-infrared (700–900 nm) regions, optical fluorescence imaging in the second optical tissue transparency window (1000–2300 nm) demonstrates low photon scattering, deeper penetration into the tissues and lower autofluorescence. In the present study, biocompatible upconversion nanoparticles with different contents of doping lanthanides, capable of luminescence in the visible and short-wave IR regions, were obtained and characterized. Also, targeted complexes based on Gd-containing nanophosphors were obtained as potential contrast agents for magnetic resonance imaging. Selective binding of targeted complexes to the surface of tumor cells expressing the HER2 receptor was shown.