Sodium-ion batteries (SIBs) are promising alternatives to lithium-ion batteries as green energy storage devices because of their similar working principles and the abundance of low-cost sodium resources. Nanostructured carbon materials are attracting great interest as high-performance anodes for SIBs. Herein, a simple and fast technique to prepare carbon nanofibers (CNFs) is presented, and the effects of carbonization conditions on the morphology and electrochemical properties of CNF anodes in Li- and Na-ion batteries are investigated. Porous CNFs containing graphene were fabricated via centrifugal spinning, and MoS2 were decorated on graphene-included porous CNFs via hydrothermal synthesis. The effect of MoS2 on the morphology and the electrode performance was examined in detail. The results showed that the combination of centrifugal spinning, hydrothermal synthesis, and heat treatment is an efficient way to fabricate high-performance electrodes for rechargeable batteries. Furthermore, CNFs fabricated at a carbonization temperature of 800 °C delivered the highest capacity, and the addition of MoS2 improved the reversible capacity up to 860 mAh/g and 455 mAh/g for Li- and Na-ion batteries, respectively. A specific capacity of over 380 mAh/g was observed even at a high current density of 1 A/g. Centrifugal spinning and hydrothermal synthesis allowed for the fabrication of high-performance electrodes for sodium ion batteries.