We demonstrate that nanoporous metal–organic frameworks (MOFs) loaded with silver can serve as templates for ordered nanostructures comprising either silver nanoparticles or nanowires. Exposure to an electron beam breaks down the template, leading to rapid silver coalescence. The geometric and chemical structure of the MOF, as well as the extent of metal loading, determine whether nanoparticles or nanowires are formed and define their size and orientation. Nanowires with diameters as small as 4 nm and aspect ratios >125 can be formed, overcoming the limitations of existing templating methods. This method is relatively simple, compatible with many materials, and proceeds by a distinct template-directed growth mechanism. Since MOFs offer an unprecedented level of synthetic flexibility, combined with highly uniform porosity as a result of their crystalline structure, this approach opens a promising new route for synthesis of self-assembled, ordered nanostructures.