The present invention relates to a pteridinone derivative serving as an EGFR inhibitor and use thereof. Specifically, the present invention relates to a compound represented by the following formula I, pharmaceutical composition comprising the compound of the following formula I, and use of the compound in preparation of drugs for treating EGFR-mediated diseases or inhibiting EGFR.