Betaine is an important osmoprotectant, synthesized by many plants in response to abiotic stresses. Almost all known biosynthetic pathways of betaine are two-step oxidations of choline. Recently, a biosynthetic pathway of betaine from glycine, catalyzed by two N-methyltransferase enzymes, was found. Here, the potential role of N-methyltransferase genes for betaine synthesis was examined in a freshwater cyanobacterium, Synechococcus sp. PCC 7942, and in Arabidopsis plants. It was found that the coexpression of N-methyltransferase genes in Synechococcus caused accumulation of a significant amount of betaine and conferred salt tolerance to a freshwater cyanobacterium sufficient for it to become capable of growth in seawater. Arabidopsis plants expressing N-methyltransferase genes also accumulated betaine to a high level in roots, stems, leaves, and flowers and improved seed yield under stress conditions. Betaine levels were higher than those produced by choline-oxidizing enzymes. These results demonstrate the usefulness of glycine N-methyltransferase genes for the improvement of abiotic stress tolerance in crop plants.