Pyrrolo[2, 3-d]pyrimidines and pyrrolo[3, 2-d]pyrimidines were synthesized in high yields by the palladiumcatalyzed reaction of 4-acetylamino-5-bromopyrimidines and 5-acetylamino-4-iodopyrimidines with (Z)-1-ethoxy-2-(tributylstannyl)ethene followed by cyclization under acidic conditions.