Angiosperms developed floral nectaries that reward pollinating insects. Although nectar function and composition have been characterized, the mechanism of nectar secretion has remained unclear. Here we identify SWEET9 as a nectary-specific sugar transporter in three eudicot species: Arabidopsis thaliana, Brassica rapa (extrastaminal nectaries) and Nicotiana attenuata (gynoecial nectaries). We show that SWEET9 is essential for nectar production and can function as an efflux transporter. We also show that sucrose phosphate synthase genes, encoding key enzymes for sucrose biosynthesis, are highly expressed in nectaries and that their expression is also essential for nectar secretion. Together these data are consistent with a model in which sucrose is synthesized in the nectary parenchyma and subsequently secreted into the extracellular space via SWEET9, where sucrose is hydrolysed by an apoplasmic invertase to produce a mixture of sucrose, glucose and fructose. The recruitment of SWEET9 for sucrose export may have been a key innovation, and could have coincided with the evolution of core eudicots and contributed to the evolution of nectar secretion to reward pollinators.