The functionality of materials is determined by their composition1–4 and microstructure, that is, the distribution and orientation of crystalline grains, grain boundaries and the defects within them5,6. Until now, characterization techniques that map the distribution of grains, their orientation and the presence of defects have been limited to surface investigations, to spatial resolutions of a few hundred nanometres or to systems of thickness around 100 nm, thus requiring destructive sample preparation for measurements and preventing the study of system-representative volumes or the investigation of materials under operational conditions7–15. Here we present X-ray linear dichroic orientation tomography (XL-DOT), a quantitative, non-invasive technique that allows for an intragranular and intergranular characterization of extended polycrystalline and non-crystalline16 materials in three dimensions. We present the detailed characterization of a polycrystalline sample of vanadium pentoxide (V2O5), a key catalyst in the production of sulfuric acid17. We determine the nanoscale composition, microstructure and crystal orientation throughout the polycrystalline sample with 73 nm spatial resolution. We identify and characterize grains, as well as twist, tilt and twin grain boundaries. We further observe the creation and annihilation of topological defects promoted by the presence of volume crystallographic defects. The non-destructive and spectroscopic nature of our method opens the door to operando combined chemical and microstructural investigations11,18 of functional materials, including energy, mechanical and quantum materials.