A process for the preparation of ranolazine comprises the step of condensing N-(2,6-dimethylphenyl)-1-piperazinyl acetamide with a compound of formula (I) to obtain ranolazine, in which X is chlorine or bromine. Ranolazine is prepared by condensing ring-opening halide which replaces epoxide in this process.