The reaction of an ester with N,O-dimethylhydroxylamine and a suitable organomagnesium reagent or lithium amide base provides a general method for the preparation of N-methoxy-N-methylamides. Application in the direct conversion of a highly hindered ester to a ketone, the azasteroid 5α-reductase inhibitor MK-0434, is described.