A new synthetic strategy for the preparation of imidazo[1,2-a]pyridines 10 is reported, which is based on the electrocyclization reaction of imino pyridinium salts 7 upon treatment with a strong base. The starting materials are easily prepared from 2-aminopyridine (3) by imine condensation and subsequent alkylation at the pyridine nitrogen atom. The ring closure reaction of the zwitterionic intermediate 8 to give a five-membered ring proceeds in low yield forming first the dihydro compound 9, which under the reaction conditions is transformed into the corresponding aromatic compounds 10 and 11 by air oxidation. The mechanism of the electrocyclization reaction is interpreted in detail by quantum-chemical calculations.