The state feedback controller is increasingly applied in electrical drive systems due to robustness and good disturbance compensation, however its main drawback is related to complex and time consuming tuning process. It is particularly troublesome for designer, if the plant is compound, nonlinear elements are taken into account, measurement noise is considered, etc. In this paper the application of nature-inspired optimization algorithm to automatic tuning of state feedback speed controller (SFC) for two-mass system (TMS) is proposed. In order to obtain optimal coefficients of SFC, the Artificial Bee Colony algorithm (ABC) is used. The objective function is described and discussed in details. Comparison with analytical tuning method of SFC is also included. Additionally, the stability analysis for the control system, optimized using the ABC algorithm, is presented. Synthesis procedure of the controller is utilized in Matlab/Simulink from MathWorks. Next, obtained coefficients of the controller are examined on the laboratory stand, also with variable moment of inertia values, to indicate robustness of the controller with optimal coefficients.