A sensitive and reliable method was developed and validated for detection and confirmation of melamine in egg based on gas chromatography-mass spectrometry (GC-MS) and ultra-performance liquid chromatography-tandem mass spectrometry (UPLC-MS/MS). Trichloroacetic acid solution was used for sample extraction and precipitation of proteins. The aqueous extracts were subjected to solid-phase extraction by mixed-mode reversed-phase/strong cation-exchange cartridges. Using ultra-performance liquid chromatography and electrospray ionization in the positive ion mode, melamine was determined by LC-MS/MS, which was completed in 5 min for each injection. For the GC-MS analysis, extracted melamine was derivatized with N,O-bis(trimethylsilyl)trifluoracetamide prior to selected ion monitoring detection in electron impact mode. The average recovery of melamine from fortified samples ranged from 85.2% to 103.2%, with coefficients of variation lower than 12%. The limit of detection obtained by GC-MS and UPLC-MS/MS was 10 and 5 microg kg(-1), respectively. This validated method was successfully applied to the determination of melamine in real samples from market.