Summary O-redox in compounds with Li on the transition-metal layers (TML) has recently been attributed to the formation of molecular O2 on charge, trapped in the lattice. Here, we show that a similar process occurs for P2-Na0.67[Mn0.72Mg0.28]O2, which contains Mg2+ on the TML. The molecular O2 is identified by high-resolution RIXS and quantified by magnetometry, showing that it equates to the charge passed. This O2 is trapped in voids that are formed by Mg2+ out-of-plane displacement and Mn4+ in-plane disordering and is then reduced on discharge associated with a large voltage hysteresis. In contrast to compounds containing Li+ in the TML, in which the honeycomb ordering and the high-voltage plateau are irreversibly lost after the first cycle, in P2-Na0.67[Mn0.72Mg0.28]O2, the plateau reappears partially on the second charge due to the partial reversibility of Mn in-plane and Mg out-of-plane migration and the local reformation of the honeycomb ordering.