Abstract: A hydraulic motor with rotating shaft coupled to a piston with alternating rectilinear displacement. The hydraulic motor comprises a casing enclosing a rotating shaft, a piston and an inverter comprising a first sleeve formed as one piece with the piston, a second sleeve, fixed in position, and a distributor mounted so as to rotate in the interior of the second sleeve and conduit and hole elements arranged between the second sleeve and the distributor and means for controlling the rotation of the distributor as a function of the displacement of the first sleeve so as to invert the direction of displacement of the piston.