An iodine(III)-catalyzed general method for the synthesis of fully functionalized NH-pyrazoles and isoxazoles from α,β-unsaturated hydrazones and oximes, respectively, via cyclization/1,2-aryl shift/aromatization/detosylation, has been developed. The reaction progresses through an anti-Baldwin 5-endo-trig cyclization. It gives direct access to an advanced intermediate for the preparation of valdecoxib