Graphitic-nitrogen doped mesoporous carbon (accounting 85% in all nitrogen species) was easily synthesized by using acetonitrile as a precursor and SBA-15 as a hard template through a chemical vapour deposition method and exhibited a better catalytic performance than other nitrogen-doped carbon materials for selective oxidation of ethylbenzene.