Using styrene (St) and N,N′‐dimethylaminoethyl methacrylate (DMAEMA) as raw materials, monodispersed P(St‐co‐DMAEMA) nanoparticles (NPs) were first prepared via semi‐continuous emulsion polymerization, and using a stepwise acid–alkali post‐treatment, porous P(St‐co‐DMAEMA) NPs were then obtained and used to adsorb heavy metal ions in aqueous phase. Results showed that the post‐treatment conditions including temperature, initial pH and time of acid–alkali treatment had significant effects on the morphology of the porous P(St‐co‐DMAEMA) NPs, with higher temperature, more extreme pH condition and longer treatment time resulting in larger pores and volume swelling ratio. Under the optimized acid–alkali post‐treatment conditions (60 °C, acid treatment at pH = 4.0 for 1 h and then alkali treatment at pH = 10.0 for 1 h), the obtained porous NPs had nearly 15 times the surface area and 1.5 times the amount of surface amino groups than the corresponding solid NPs. An analysis of the mechanism of metal ion adsorption on the porous NPs indicated that the adsorbed amount of metal ions was the result of synergistic effect of physical and chemical adsorption, which was closely related to the porous NP surface area, amount of surface of amino groups and the volume of the ions. © 2018 Society of Chemical Industry