A new nanoscale sensing concept for the detection of nitroaromatic explosives is described. The design consists of nitroaromatic-selective polymeric layers deposited inside microfabricated trenches. As the layers are exposed to nitroaromatic vapors, they swell and contact each other to close an electrical circuit. The nitroaromatic selective polymer, poly(4-vinylpyridine) (P4VP), is deposited in the trenches using initiated chemical vapor deposition (iCVD). P4VP is characterized for the first time as a selective layer for the absorption of nitroaromatic vapors. The Flory–Huggins equation is used to model the swelling response to nitroaromatic vapors. The Flory–Huggins interaction parameter for the P4VP–nitrobenzene system at 40 °C is 0.71 and 0.25 for P4VP–4-nitrotoluene at 60 °C. Sensing of nitrobenzene vapors is demonstrated in a prototype device, while techniques to improve the performance of the design in terms of response time and sensitivities are described. Modeling shows that concentration and mass limits of detection of 0.95 ppb and 3 fg, respectively, can be achieved.