This is the first report of an efficient and effective procedure to optimize the biosynthesis of huperzine A (HupA) and huperzine B (HupB) in vitro from Huperzia selago gametophytes. Axenic tissue cultures were established using spores collected from the sporophytes growing in the wild. The prothalia were obtained after 7–18 months. Approximately 90 up to 100% of the gametophytes were viable and grew rapidly after each transfer on to a fresh medium every 3 months. The best biomass growth index for prothallus calculated on a fresh (FW) and dry weight (DW) basis, at 24 weeks of culture, was 2500% (FW) and 2200% (DW), respectively. The huperzine A content in the gametophytes was very high and ranged from 0.74 mg/g to 4.73 mg/g DW. The highest yield HupA biosynthesis at >4 mg/g DW was observed on W/S medium without growth regulators at 8 to 24 weeks of culture. The highest HupB content ranged from 0.10 mg/g to 0.52 mg/g DW and was obtained on the same medium. The results demonstrate the superiority of H. selago gametophyte cultures, with the level of HupA biosynthesis approximately 42% higher compared to sporophyte cultures and 35-fold higher than when the alkaloid was isolated from H. serrata, its current source for the pharmaceutical industry. Moreover, the biosynthesis of HupB was several-fold more efficient than in H. selago sporophytes growing in the wild. HPLC-HR-MS analyses of the extracts identified eight new alkaloids previously unreported in H. selago: deacetylfawcettine, fawcettimine, 16-hydroxyhuperzine B, deacetyllycoclavine, annopodine, lycopecurine, des-N-methylfastigiatine and flabelline.