In this work, a novel polystyrene/Fe3O4 nanocomposite prepared by in-situ method is presented. Magnetic Fe3O4 nanoparticles were encapsulated by polystyrene. The FT-IR spectra confirmed polystyrene/Fe3O4 nanocomposite preparation. The electrical properties of prepared nanocomposite were investigated by cyclic voltammetry (CV). The CV analysis showed good electrical conductivity of the synthesized nanocomposite. Magnetic properties of the nanocomposite were studied by vibrating sample magnetometer (VSM). The VSM analysis confirmed magnetic properties of the nanocomposite. The morphology and the size of the synthesized nanocomposite were investigated by field emission scanning electron microscope (FESEM). According to the VSM and CV results, such nanocomposite can be used in microelectromechanical systems.