Method for controlling a drive system of a vehicle, the drive system comprises a combustion engine with an output shaft, a gearbox with an input shaft, an electrical machine that comprises a stator and a rotor, and a planetary gear that comprises three components in the form of a sun gear, a ring gear and a planet wheel carrier, wherein the output shaft of the combustion engine is connected with a first of said components of the planetary gear so that a rotation of this shaft results in a rotation of this component, wherein the input shaft of the gearbox is connected with a second of said components of the planetary gear so that a rotation of this shaft results in a rotation of this component and the rotor of the electrical machine is connected with a third of said components of the planetary gear so that a rotation of the rotor results in a rotation of this component, and wherein the drive system further comprises locking means transferable between a locked state in which two of said components are locked together so that the three components rotate with the same speed of rotation and a released state in which the components are allowed to rotate with different speed of rotation, wherein the output shaft of the combustion engine is connected to the sun gear so that they rotate as a unit with a first speed of rotation, that the input shaft of the gear box is connected to the planet wheel carrier so that they rotate as a unit with a second speed of rotation, and that the rotor of the electrical machine is connected to the ring gear so that the ring gear rotates with a third speed of rotation, wherein the combustion engine comprises an active state and an inactive state, characterised in that the drive system comprises a braking device comprising an active state in which the combustion engine is prevented from rotating and a passive state in which the combustion engine is allowed to rotate and that the gearbox comprises at least a forward gear and at least a reverse gear, the method comprising the steps: - arranging the planetary gear in the released state, the combustion engine in the inactive state, and the braking device in the active state, - receiving information on a requested torque for the operation of the vehicle, and - controlling the electrical machine so that the requested torque is provided while maintaining the combustion engine in the inactive state, the braking device in the active state and the planetary gear in the released state, and wherein the method further comprises: - receiving information on if the vehicle is in a standing still state or in a movable state, - if the vehicle is in the standing still state, the planetary gear is arranged in the released state, the combustion engine is arranged in the inactive state, and the braking device in the active state, and - arranging the gearbox in a forward gear and the electrical machine is controlled to generate a positive torque, when it is necessary to choose between different gears during driving, and - arranging the gearbox in a reversed gear and the electrical machine is controlled to generate a negative torque when the combustion engine later is to be started. - arranging the planetary gear in the released state, the combustion engine in the inactive state, and the braking device in the active state, - receiving information on a requested torque for the operation of the vehicle, and - controlling the electrical machine so that the requested torque is provided while maintaining the combustion engine in the inactive state, the braking device in the active state and the planetary gear in the released state, - receiving information on if the vehicle is in a standing still state or in a movable state, - if the vehicle is in the standing still state, the planetary gear is arranged in the released state, the combustion engine is arranged in the inactive state, and the braking device in the active state, and - arranging the gearbox in a forward gear and the electrical machine is controlled to generate a positive torque, when it is necessary to choose between different gears during driving, and - arranging the gearbox in a reversed gear and the electrical machine is controlled to generate a negative torque when the combustion engine later is to be started.