It is not easy to fabricate materials that exhibit their theoretical ‘ideal’ strength. Most methods of producing stronger materials are based on controlling defects to impede the motion of dislocations, but such methods have their limitations. For example, industrial single-phase nanocrystalline alloys and single-phase metallic glasses can be very strong, but they typically soften at relatively low strains (less than two per cent) because of, respectively, the reverse Hall–Petch effect and shear-band formation. Here we describe an approach that combines the strengthening benefits of nanocrystallinity with those of amorphization to produce a dual-phase material that exhibits near-ideal strength at room temperature and without sample size effects. Our magnesium-alloy system consists of nanocrystalline cores embedded in amorphous glassy shells, and the strength of the resulting dual-phase material is a near-ideal 3.3 gigapascals—making this the strongest magnesium-alloy thin film yet achieved. We propose a mechanism, supported by constitutive modelling, in which the crystalline phase (consisting of almost-dislocation-free grains of around six nanometres in diameter) blocks the propagation of localized shear bands when under strain; moreover, within any shear bands that do appear, embedded crystalline grains divide and rotate, contributing to hardening and countering the softening effect of the shear band.