Method to control a hybrid powertrain in a vehicle, comprising - a combustion engine, - an electric machine, and - a gearbox with an input shaft and an output shaft, wherein the combustion engine and the electric machine are connected to the input shaft, wherein the method comprises the following steps: a) to control the gearbox to a neutral position; b) to control the speed of the electric machine to a predetermined speed, which corresponds to a target speed for the input shaft according to the next gear selected; c) to engage a gear in the gearbox; characterised in that the method further comprises the following steps: d) to control the electric machine with a predetermined torque limitation, so that the electric machine is accelerated or decelerated depending on a requested driving torque for the vehicle; e) to detect when a control signal for the electric machine corresponds to a predetermined signal value corresponding to a predetermined torque for elimination of gap between interacting components in the powertrain; and f) to control the electric machine to the requested driving torque. - a combustion engine, - an electric machine, and - a gearbox with an input shaft and an output shaft, wherein the combustion engine and the electric machine are connected to the input shaft, wherein the method comprises the following steps: a) to control the gearbox to a neutral position; b) to control the speed of the electric machine to a predetermined speed, which corresponds to a target speed for the input shaft according to the next gear selected; c) to engage a gear in the gearbox; characterised in that the method further comprises the following steps: d) to control the electric machine with a predetermined torque limitation, so that the electric machine is accelerated or decelerated depending on a requested driving torque for the vehicle; e) to detect when a control signal for the electric machine corresponds to a predetermined signal value corresponding to a predetermined torque for elimination of gap between interacting components in the powertrain; and f) to control the electric machine to the requested driving torque. a) to control the gearbox to a neutral position; b) to control the speed of the electric machine to a predetermined speed, which corresponds to a target speed for the input shaft according to the next gear selected; c) to engage a gear in the gearbox; characterised in that the method further comprises the following steps: d) to control the electric machine with a predetermined torque limitation, so that the electric machine is accelerated or decelerated depending on a requested driving torque for the vehicle; e) to detect when a control signal for the electric machine corresponds to a predetermined signal value corresponding to a predetermined torque for elimination of gap between interacting components in the powertrain; and f) to control the electric machine to the requested driving torque. d) to control the electric machine with a predetermined torque limitation, so that the electric machine is accelerated or decelerated depending on a requested driving torque for the vehicle; e) to detect when a control signal for the electric machine corresponds to a predetermined signal value corresponding to a predetermined torque for elimination of gap between interacting components in the powertrain; and f) to control the electric machine to the requested driving torque.