The C-branched pentose sugar d-apiose is important for plant cell wall development. Its biosynthesis as urdine diphosphate-d-apiose (UDP-d-apiose) involves decarboxylation of the UDP-d-glucuronic acid precursor coupled with pyranosyl-to-furanosyl sugar ring contraction. This unusual multistep reaction is catalysed in a single active site by UDP-d-apiose/UDP-d-xylose synthase (UAXS). Here we decipher the UAXS catalytic mechanism on the basis of crystal structures of the enzyme (which is from Arabidopsis thaliana), molecular dynamics simulations that are expanded by hybrid quantum mechanics/molecular mechanics calculations and mutational mechanistic analyses. Our studies show how UAXS uniquely integrates a classical catalytic cycle of oxidation and reduction by a tightly bound nicotinamide co-enzyme with retroaldol/aldol chemistry for the sugar ring contraction. We further demonstrate that decarboxylation occurs only after the sugar ring opening and identify that the thiol group of Cys100 steers the sugar skeleton rearrangement by proton transfer to and from C3′. The mechanistic features of UAXS highlight the evolutionary expansion of the basic catalytic apparatus of short-chain dehydrogenases/reductases for functional versatility in sugar biosynthesis. © 2019, The Author(s), under exclusive licence to Springer Nature Limited.