Capillary condensation, an often undesired natural phenomenon in nanoporous materials, was used advantageously as a universal functionalization strategy in nanoparticle thin films assembled layer-by-layer. Judicious choice of nanoparticle (and therefore pore) size allowed targeted capillary condensation of chemical vapors of both hydrophilic and hydrophobic molecules across film thickness. Heterostructured thin films with modulated refractive index profiles produced in this manner exhibited broadband antireflection properties with an average reflectance over the visible region of the spectrum of only 0.4%. Capillary condensation was also used to modify surface chemistry and surface energy. Photosensitive capillary-condensates were UV-cross-linked in situ. Undesired adventitious condensation of humidity could be avoided by condensation of hydrophobic materials such as poly(dimethyl siloxane). © 2009 American Chemical Society.