Method for machining a gearwheel by means of stock removal from a workpiece using a numerical-control machine tool with at least five machining axes, characterised by the steps of: defining prefinishing surfaces and finishing surfaces of the gearwheel as theoretical surfaces which would be respectively defined by a roughing hob and a finishing hob of a gear-cutting machine; defining theoretical prefinishing surfaces and theoretical finishing surfaces of the gearwheel as the prefinishing surfaces and the finishing surfaces respectively so as the theoretical finishing surface is underneath the theoretical prefinishing surface along parts of tooth of the gearwheel where a finishing operation must remove material and the theoretical finishing surface is above the theoretical prefinishing surface along parts of tooth of the gearwheel where stock removal is not required during the finishing operation; calculating a line of intersection between the theoretical prefinishing surface and the theoretical finishing surface; using as real prefinishing surface the theoretical prefinishing surface and as real finishing surface for each tooth the part of the theoretical finishing surface situated between the tip of the tooth and the said line of intersection; operating the numerical-control machine so as to perform a first gearwheel machining operation on the workpiece where tools of the numerical-control machine follow machining surfaces so as to form the said real prefinishing surface directly in the workpiece and then operating the numerical-control machine so as to perform a second gearwheel machining operation on the workpiece where tools of the numerical-control machine follow: - machining surfaces so as to form for each tooth the said real finishing surfaces in the workpiece between the tip of the tooth and said line of intersection, and - paths where the numerical-control machine use internal routines for movement of the tools so as to move freely the tools from one real machining surface to another real machining surface without the tools follows the theoretical finishing surface between the one real machining surface to the another real machining surface, and travelling time of the tools is not wasted along the theoretical finishing surface between the one real machining surface to the another real machining surface. defining prefinishing surfaces and finishing surfaces of the gearwheel as theoretical surfaces which would be respectively defined by a roughing hob and a finishing hob of a gear-cutting machine; defining theoretical prefinishing surfaces and theoretical finishing surfaces of the gearwheel as the prefinishing surfaces and the finishing surfaces respectively so as the theoretical finishing surface is underneath the theoretical prefinishing surface along parts of tooth of the gearwheel where a finishing operation must remove material and the theoretical finishing surface is above the theoretical prefinishing surface along parts of tooth of the gearwheel where stock removal is not required during the finishing operation; calculating a line of intersection between the theoretical prefinishing surface and the theoretical finishing surface; using as real prefinishing surface the theoretical prefinishing surface and as real finishing surface for each tooth the part of the theoretical finishing surface situated between the tip of the tooth and the said line of intersection; operating the numerical-control machine so as to perform a first gearwheel machining operation on the workpiece where tools of the numerical-control machine follow machining surfaces so as to form the said real prefinishing surface directly in the workpiece and then operating the numerical-control machine so as to perform a second gearwheel machining operation on the workpiece where tools of the numerical-control machine follow: - machining surfaces so as to form for each tooth the said real finishing surfaces in the workpiece between the tip of the tooth and said line of intersection, and - paths where the numerical-control machine use internal routines for movement of the tools so as to move freely the tools from one real machining surface to another real machining surface without the tools follows the theoretical finishing surface between the one real machining surface to the another real machining surface, and travelling time of the tools is not wasted along the theoretical finishing surface between the one real machining surface to the another real machining surface. - machining surfaces so as to form for each tooth the said real finishing surfaces in the workpiece between the tip of the tooth and said line of intersection, and - paths where the numerical-control machine use internal routines for movement of the tools so as to move freely the tools from one real machining surface to another real machining surface without the tools follows the theoretical finishing surface between the one real machining surface to the another real machining surface, and travelling time of the tools is not wasted along the theoretical finishing surface between the one real machining surface to the another real machining surface.