Bioisosteric replacements are often tried goaling to affect the lipophilicity, polarity, and aqueous solubility of the substances, as a way to obtain therapeutically improved medicines. Also, hydrazonyl compounds are described with a wide range of pharmacological activities, having also recognized activities in antimycobacterial field. In this study, twenty-seven pyrimidinyl and pyrazinyl derivatives have been synthesized and evaluated for their antimycobacterial activity against M. tuberculosis ATTC 27294. The componds were obtained by the reaction of 2-hydrazinylpyridine, 4-hydrazinylpyridine, or 2-hydrazinylpyrazine with appropriated aromatic or heteroaromatic aldehydes. Antimycobacterial activity of the compounds was determined according to MTT assay. The most active compound, a 2-hydroxyl-5-nitrophenyl-4-pyridinylhydrazone derivative, showed good biodisponibility and nonmutagenic or tumorigenic profiles in preliminaries in silico studies, and exceptional in vitro activity, being compared with the reference drug ethambutol. This study supports that pyrimidinyl and pyrazinyl derivatives may be used for the development of new tuberculostatic agents.