A new and effective control method of a power compensator with a lithium-ion battery for D.C railway systems has been developed in this paper. A compensator stores regenerated energy into the battery, and discharges to powering trains for stabilizing line voltage and for improving the compensator efficiency of the railway system. The charging and discharging currents are controlled according to the line voltage, although the instantaneous charging power of the lithium-ion battery is heavily depends on its SOC (state of charge). The conventional control method requires an additional SOC regulator to track the optimal operating point. The proposed method increases the maximum discharge current proportional to the SOC, and automatically keeps the maximum power without the SOC regulator. Numerical simulations are carried out for the final design of the power compensator. The results show that the proposed method improves the efficiency of the compensator compared with that of the conventional system.