A system and a method for controlling a tool pivotably mounted to an articulated boom connected to a work machine having a control unit. The solution: 1) determining the direction a predetermined point of the boom or the tool is moving to, i.e. the moving direction, and 2) controlling orientation of the tool as a function of one or several predetermined dependencies, the predetermined dependencies defining at least the orientation of the tool in relation to the moving direction. According to an example the work machine is a forest machine.