To use the large stokes shift and low self quenching of luminescence, we have successfully constructed two luminescent yttrium based MOFs doped with europium and terbium, [Y0.9Eu0.1(OBA)(Ox)0.5(H2O)2], Y-MOF:Eu and [Y0.9Tb0.1(OBA)(Ox)0.5(H2O)2], Y-MOF:Tb through an isomorphous substitution technique using a two dimensional metal–organic framework (MOF) [Y1.0(OBA)(Ox)0.5(H2O)2], [OBA = 4,4′-oxybis(benzoic acid), Ox = oxalate], Y-MOF, as a structural basis. The structure and size of Y-MOF, Y-MOF:Eu and Y-MOF:Tb were systematically characterized by PXRD, TGA, SEM and EDX analysis. Y-MOF:Eu and Y-MOF:Tb shows high intensity visible red and green emission, respectively, on the exposure of UV light. These emissions of Y-MOF:Eu and Y-MOF:Tb were used for the visible detection of nitro explosives such as 2,4,6-trinitrophenol (TNP), 1,3-dinitro benzene (DNB), 2,4-dinitro toluene (DNT), nitro benzene (NB), 4-nitro toluene (NT) in acetonitrile through luminescence quenching. Y-MOF:Eu and Y-MOF:Tb shows superior sensitivity towards TNP and NT compared to other nitroaromatic explosives. The large stokes shift of Y-MOF:Eu and Y-MOF:Tb allows naked eye detection of these nitroaromatics. The observed KSV (quenching constant obtained from Stern–Volmer plots) values are in the range 3.2 × 104 to 0.4 × 104 M−1 for Y-MOF:Eu and 3.19 × 104 to 0.47 × 104 M−1 for Y-MOF:Tb. Using these materials ppm level detection of nitro explosives has been achieved.