Metastable phases-kinetically favoured structures-are ubiquitous in nature(1,2). Rather than forming thermodynamically stable ground-state structures, crystals grown from high-energy precursors often initially adopt metastable structures depending on the initial conditions, such as temperature, pressure or crystal size(1,3,4). As the crystals grow further, they typically undergo a series of transformations from metastable phases to lower-energy and ultimately energetically stable phases(1,3,4). Metastable phases sometimes exhibit superior physicochemical properties and, hence, the discovery and synthesis of new metastable phases are promising avenues for innovations in materials science(1,5). However, the search for metastable materials has mainly been heuristic, performed on the basis of experiences, intuition or even speculative predictions, namely 'rules of thumb'. This limitation necessitates the advent of a new paradigm to discover new metastable phases based on rational design. Such a design rule is embodied in the discovery of a metastable hexagonal close-packed (hcp) palladium hydride (PdHx) synthesized in a liquid cell transmission electron microscope. The metastable hcp structure is stabilized through a unique interplay between the precursor concentrations in the solution: a sufficient supply of hydrogen (H) favours the hcp structure on the subnanometre scale, and an insufficient supply of Pd inhibits further growth and subsequent transition towards the thermodynamically stable face-centred cubic structure. These findings provide thermodynamic insights into metastability engineering strategies that can be deployed to discover new metastable phases.