Doping is a widely applied technological process in materials science that involves incorporating atoms or ions of appropriate elements into host lattices to yield hybrid materials with desirable properties and functions. For nanocrystalline materials, doping is of fundamental importance in stabilizing a specific crystallographic phase, modifying electronic properties, modulating magnetism as well as tuning emission properties. Here we describe a material system in which doping influences the growth process to give simultaneous control over the crystallographic phase, size and optical emission properties of the resulting nanocrystals. We show that NaYF(4) nanocrystals can be rationally tuned in size (down to ten nanometres), phase (cubic or hexagonal) and upconversion emission colour (green to blue) through use of trivalent lanthanide dopant ions introduced at precisely defined concentrations. We use first-principles calculations to confirm that the influence of lanthanide doping on crystal phase and size arises from a strong dependence on the size and dipole polarizability of the substitutional dopant ion. Our results suggest that the doping-induced structural and size transition, demonstrated here in NaYF(4) upconversion nanocrystals, could be extended to other lanthanide-doped nanocrystal systems for applications ranging from luminescent biological labels to volumetric three-dimensional displays.