The invention provides a method for the preparation of fentanyl comprising: (a) reacting 4-piperidone hydrochloride (NPP) with aniline in presence of reducing environment to produce 4-anilinopiperidine (4- ANPP), (b) alkylating/reacting the 4- ANPP as obtained from step (a) with phenethyl halide under reflux conditions in highly alkaline medium to give 4-anilino-N-phenethylpiperidine, and (c) converting the said 4-anilino-N-phenethylpiperidine to fentanyl by reacting with propionyl chloride in presence of halogenated hydrocarbons then isolating fentanyl by solvent extraction and purified by crystallization from petroleum ether (60-80 °C).