Novel poly(N-ethylaniline)/lignosulfonate (PNA–LS) composites were prepared via an in situ polymerization of N-ethylaniline (NA) with lignosulfonate (LS) as a dispersant. Nitrogen-containing carbon materials were obtained by direct pyrolysis of the PNA–LS composites at the pyrolytic temperatures ranging from 300°C to 1200°C. The as-prepared PNA–LS composites and their carbon materials were investigated by TGA, SEM, TEM, FTIR and UV–vis spectra, XRD and elemental analysis. The results showed that the morphology, structure and properties of the PNA–LS composites were depended on the LS:NA mass ratio. PNA–LS microspheres with an average diameter of 1300nm could be fabricated when the LS:NA mass ratio was 2.5:97.5, while regular hexagon sheets of PNA–LS composite were obtained with the LS:NA mass ratio above 5:95. Furthermore, nitrogen-containing carbon nanospheres with an average diameter of 820nm were achieved at the carbonization temperature of 800°C.