Methyltransferase which catalyzes the transfer of a methyl group onto N-acetylserotonin, producing melatonin (N-acetyl-5-methoxytryptamine). N-acetylserotonin + S-adenosyl-L-methionine = H(+) + melatonin + S-adenosyl-L-homocysteine Optimum pH is 7.8. Optimum temperature is 55 degrees Celsius. Aromatic compound metabolism; melatonin biosynthesis; melatonin from serotonin: step 1/2. Homodimer. Expressed in leaves, stems and flowers. By senescence, abscisic acid (ABA), acifluorfen, salt and cadmium (PubMed:21210840). Induced by copper (PubMed:18676621, PubMed:21210840). Induced by butafenacil (PubMed:22998587). Induced in dark-grown etiolated shoot (PubMed:22747959). Induced by UV-C (PubMed:24035516). Belongs to the class I-like SAM-binding methyltransferase superfamily. Cation-independent O-methyltransferase family.