Modeling of robot motion as dynamical movement primitives (DMPs) has become an important framework within robot learning and control. The ability of DMPs to adapt online with respect to the surroundings, e.g., to moving targets, has been used and developed by several researchers. In this work, a method for handling perturbations during execution of DMPs on robots was developed. Two-degree-of-freedom control was introduced in the DMP context, for reference trajectory tracking and perturbation recovery. Benefits compared to the state of the art were demonstrated. The functionality of the method was verified in simulations and in real-world experiments.