A facile synthesis of imidazo[4,5-b]pyridines and -pyrazines is described using a Pd-catalyzed amide coupling reaction. This reaction provides quick access to products with substitution at N1 and C2. A model system relevant to the natural product pentosidine has been demonstrated, as well as the total synthesis of the mutagen 1-Me-5-PhIP.