The paper presents a method of the simulation of electrical effects of stray currents from d.c. tracrion of complex geometry. In the method the equivalent rail is considered as an earth return circuit. The models of the equivalent rail with current energization and the concept of superposition allow one to consider more complicated d.c. railway systems using a segmental approximation of the complex railway route and taking into account a number of substations and loads at any location. It is assumed in the paper that the system considered is linear, that the earth is homogeneous medium of finite conductivity and that the effects of currents in nearby underground metal installations on the potential generated in the earth by track currents (primary earth potential) can be disregarded. An extensive parametric analysis to examine the roles of various factors, which affect the primary earth potential caused by stray currents, may be performed using simulation program developed. The technical application of the method presented, which can be useful at design stage e.g. of metal structures buried in the stray currents area, is illustrated by examples of computer simulation.