Gantry crane for container handling; comprising: - a gantry provided with lateral legs fitted with displacement means on rails, longitudinal guides or tracks and at least one crossbeam attached to the lateral legs; - a trolley movable along the crossbeam, - a main hoisting system mounted on the movable trolley and provided with, at least, one motorized drum (31, 31 a) and with hoisting cables of a container carrier rig, wound in a first direction on a motorized drum (31, 31 a); characterized in that it comprises a counterweight system of the container carrier rig comprising, at least: - a counterweight, - a counterweight cable which comprises a first end wound onto a motorized drum (31, 31 a) in a second direction, opposite the first winding direction of the hoisting cables; and a second end attached to the movable trolley, or wound in said second direction onto a motorized drum (31, 31 a); - a first set of return pulleys for the counterweight cable arranged at opposite ends of the crossbeam of the gantry; - at least a second return pulley for the counterweight cable mounted on the movable trolley; said counterweight cable forming a loop of variable length which comprises a horizontal section arranged along the crossbeam of the gantry and at least one vertical end section from which a counterweight is suspended by means of a pulley; in that: - the counterweight cable loop comprises two vertical end sections arranged on opposite sides of the gantry; - two separate counterweights are suspended from said vertical sections by means of respective pulleys; and - it comprises on the crossbeam of the gantry a height compensator for the vertical end sections of the counterweight cable loop during the traveling of the movable trolley; and in that the height compensator comprises a belt mounted on freely rotatable pulleys arranged at two opposite ends of the crossbeam of the gantry; said belt presenting a first branch (51 a) fixed onto the movable trolley, and a second branch (51 b) fixed onto the horizontal section of the counterweight cable loop. - a gantry provided with lateral legs fitted with displacement means on rails, longitudinal guides or tracks and at least one crossbeam attached to the lateral legs; - a trolley movable along the crossbeam, - a main hoisting system mounted on the movable trolley and provided with, at least, one motorized drum (31, 31 a) and with hoisting cables of a container carrier rig, wound in a first direction on a motorized drum (31, 31 a); characterized in that it comprises a counterweight system of the container carrier rig comprising, at least: - a counterweight, - a counterweight cable which comprises a first end wound onto a motorized drum (31, 31 a) in a second direction, opposite the first winding direction of the hoisting cables; and a second end attached to the movable trolley, or wound in said second direction onto a motorized drum (31, 31 a); - a first set of return pulleys for the counterweight cable arranged at opposite ends of the crossbeam of the gantry; - at least a second return pulley for the counterweight cable mounted on the movable trolley; - the counterweight cable loop comprises two vertical end sections arranged on opposite sides of the gantry; - two separate counterweights are suspended from said vertical sections by means of respective pulleys; and - it comprises on the crossbeam of the gantry a height compensator for the vertical end sections of the counterweight cable loop during the traveling of the movable trolley;