Metal nanoparticle@porous material composites have attracted increasing attention due to their excellent synergistic catalytic performance. However, it is a challenge to introduce metal nanoparticles into cavities of porous materials without agglomeration on the exterior. Despite the progress achieved, a universal approach that can integrate different kinds of metal nanoparticles and porous materials is still highly desirable. Here we report a facile and general approach to fabricating metal nanoparticle@porous materials by microwave-triggered selective heating. The microwave can pass through the non-polar solvent and act on the polar solvent in the porous materials, causing the polar solvent to be heated, vaporized, and away from the pores of porous materials. The local void produced by the escape of polar solvent facilitates non-polar solvent containing metallic precursor to be dragged into the narrow pores, followed by further reduction, resulting in the complete encapsulation of nanoparticles. A series of metal nanoparticles@porous materials, ranging from metal-organic frameworks (MOFs) to zeolites, are successfully prepared by this method and show excellent size selectivity in catalytic reactions.