An improved route for the synthesis of momelotinib has been developed. A nucleophilic addition reaction between the starting material, 4-morpholinoaniline, and cyanamide gave the 1-(4-morpholinophenyl) guanidine. Simultaneously, methyl 4-acetylbenzoate was converted into methyl (E)-4-[3-(dimethylamino) acryloyl] benzoate in the presence of N, N-dimethylformamide dimethylacetal. The enaminone intermediate was then condensed at elevated temperature in alcoholic alkali with the 1-(morpholinophenyl) guanidine to form the desired pyrimidine, which was hydrolysed to the corresponding acid. This procedure is simple in operation, without noble metal catalyst and suitable for industrial production. Finally, the desired compound momelotinib was acquired by an amidation reaction.