The present invention relates to an improved method for preparing l-(4-(4-(3,4-dichloro-2-fluorophenylamino)-7- methoxyquinazolin-6-yloxy)piperidin-l-yl)-prop-2-en-l-one hydrochloride, which selectively and effectively inhibits the growth of cancer cells induced by over-expression of an epidermal growth factor receptor (EGFR) and prevents the development of drug resistance caused by mutation of a tyrosine kinase, and intermediates used therein.