A highly water stable and strong upconversion (UC) luminescence NaYF4@PSI-NH nanosensor for the simultaneous and selective detection of 2,4,6-trinitrotoluene (TNT) and 2,4,6-trinitrophenol (TNP) was successfully developed. Via the 980 nm near-infrared (NIR) irradiation, these nanosensors emit strong white UC luminescence with five typical emission peaks centered at 363, 455, 475, 546, and 654 nm. The UC emission at both 363 and 546 nm was quenched by the addition of TNT; however, the ratio of luminescence intensity at 363 nm to 546 nm (I-363/I-546) had no change with the increase of TNT concentration. Meanwhile, only violet UC emission at 363 nm was dramatically quenched via the addition of TNP, and the I-363/I-546 ratio is negatively proportional to the TNP concentration in the range of 0.01-4.5 mu g/mL of TNP. On the other hand, the green UC emission intensity at 546 nm is in negative proportion to the concentration of TNT. Moreover, cyclohexane, toluene, and other nitroaromatics (such as 2,4-dinitrotoluene (DNT) and nitrobenzene (NB)) have no influence on the detection. Therefore, we developed a facile method for the simultaneous and selective detection of TNT and TNP in the mixture solution of nitroaromatics independent of complicated instruments and sample pretreatment.