The oceanic N-2-fixing cyanobacterium Trichodesmium spp. form extensive surface blooms and contribute significantly to marine carbon and nitrogen cycles in the oligotrophic subtropical and tropical oceans. Trichodesmium grows in salinities from 27 to 43 parts per thousand (ppt), yet its salt acclimation strategy remains enigmatic because the genome of Trichodesmium erythraeum strain IMS101 lacks all genes for the biosynthesis of any known compatible solute. Using NMR and liquid chromatography coupled to mass spectroscopy, we identified the main compatible solute in T. erythraeum strain IMS101 as the quaternary ammonium compound N,N,N-trimethyl homoserine (or homoserine betaine) and elucidated its biosynthetic pathway. The identification of this compatible solute explains how Trichodesmium spp. can thrive in the marine system at varying salinities and provides further insight into the diversity of microbial salt acclimation.