The pump sends oil to a piston inside the wrench, and the piston drives a ratchet that turns the socket or cassette. Torque is set by adjusting pump pressure, using the pressure to torque chart for that wrench model. The wrench strokes until the nut stops turning at the set pressure, which means the target torque has been reached. Each stroke, the ratchet resets automatically, which is why a hydraulic torque wrench in Qatar shutdowns can tighten large studs quickly and evenly.
Because torque depends on pressure, an accurate gauge and a pressure to torque chart that matches the tool are essential. A chart from another model or size gives the wrong torque.