A process for the preparation of 5-substituted 4-amino-2-methylpyrimidines of the formula (I) wherein R is CONH2 or CN, and of acid addition salts thereof, characterized in that a compound of formula H2N CH = C(R) CN (II) is reacted with acetlmidic acid methyl ester or an acid addition salt thereof and that, if desired, a compound of formula (I) is transferred into an acid addition salt, and the transformation of a compound of formula (II) wherein R is CONH2 into a compound of formula (II) wherein R is CN by treatment with POCI3.