Magnetic and conducting Fe3O4–polyaniline (PANI) nanoparticles with core–shell structure have been prepared in the presence of Fe3O4 magnetic fluid in aqueous solution containing dodecylbenzene sulfonic acid sodium salt (NaDS) as a surfactant and dopant. The conductivity of the composites at room temperature depended on Fe3O4 content and doping degree. The magnetic properties of the resulting composites showed ferromagnetic behavior, such as high-saturated magnetization (Ms=4.22–48.4 emu/g) and high coercive force (Hc=8–55.3 Oe). The saturated magnetization increased with the increasing Fe3O4 content. A structural characterization by elemental analysis, Fourier transform infrared, transmission electron micrograph (TEM) and powder X-ray diffraction (XRD), proved that nanometer-sized Fe3O4 (20–30 nm) in the composites was attributed to the ferromagnetic behavior of the composites. The average size of Fe3O4–polyaniline nanoparticles with core–shell structure was about 80 nm, and polydisperse. The results of TG, IR and UV spectra indicated that Fe3O4 nanoparticles could improve the composite thermal stability possibly due to the interaction between Fe3O4 particles and polyaniline backbone.