Measurements of the subjet structure of quark and gluon jets in hadronic Z decays are presented. The analysis is based on one million hadronic events recorded by the Aleph detector. Roughly symmetric three-jet events are selected with a coarse jet-resolution cut-off, y1. Gluon jets are identified with a purity of 94.6% in those events where evidence of long-lived heavy-flavour hadrons in the other two jets is found. The jets are then analyzed using a smaller cut-off y0 (< y1) so that subjets are resolved. The properties of the jets (subjet multiplicities (Nq), (Ng) and rates Rng(q) for n = 1, 2, 3, 4) are determined and are found to be in good agreement with the expectations of perturbative QCD as long as the subjet resolution parameter y0 is sufficiently large to keep non-perturbative effects small. In particular, the ratio , which to leading order in QCD is given by the ratio of colour factors , is measured to be 1.96 ± 0.15 for y0 = 2 · 10−3, but falls to 1.29 ± 0.03 for y0 = 1.6 · 10−5.