A system for variable actuation of an engine valve of an internal-combustion engine, comprising: - a hydraulic apparatus including: - a master piston, - a slave piston (44, 46) that can be driven by said master piston by means of a volume of fluid set between said master piston and said slave piston, and - a solenoid valve configured for assuming a state in which said volume of fluid is set in communication with an outlet so as to render said slave piston independent from the movement of said master piston; wherein said system further comprises: - a camshaft designed to drive said master piston in motion, which has a cam profile for governing, through said master piston, said engine valve in a four-stroke engine operating mode; - a control unit configured for controlling said solenoid valve so as to govern said engine valve, within said four-stroke engine operating mode, according to a lift and/or opening and closing times that are variable as a function of one or more parameters indicative of the operating conditions of the engine; said system being characterized in that: - said camshaft or a further camshaft has a second cam profile for governing said valve in a two-stroke operating mode; - said system comprises a rocker mechanism having: - a first rocker, which is pre-arranged for being actuated by said first cam profile, - a second rocker, which is pre-arranged for being actuated by said second cam profile, and - a selector device (72, 74) for connecting selectively said master piston with said first rocker or said second rocker, in such a way that actuation of the first rocker or of the second rocker connected to the master piston determines movement of the master piston under the control of the first cam profile or the second cam profile, - said control unit is configured for controlling said selector device so as to govern the engine valve selectively in one or other of the two operating modes, and, moreover, said control unit is configured for controlling said solenoid valve on the basis of the selected operating mode. - a hydraulic apparatus including: - a master piston, - a slave piston (44, 46) that can be driven by said master piston by means of a volume of fluid set between said master piston and said slave piston, and - a solenoid valve configured for assuming a state in which said volume of fluid is set in communication with an outlet so as to render said slave piston independent from the movement of said master piston; - a master piston, - a slave piston (44, 46) that can be driven by said master piston by means of a volume of fluid set between said master piston and said slave piston, and - a solenoid valve configured for assuming a state in which said volume of fluid is set in communication with an outlet so as to render said slave piston independent from the movement of said master piston; - a camshaft designed to drive said master piston in motion, which has a cam profile for governing, through said master piston, said engine valve in a four-stroke engine operating mode; - a control unit configured for controlling said solenoid valve so as to govern said engine valve, within said four-stroke engine operating mode, according to a lift and/or opening and closing times that are variable as a function of one or more parameters indicative of the operating conditions of the engine; - said camshaft or a further camshaft has a second cam profile for governing said valve in a two-stroke operating mode; - said system comprises a rocker mechanism having: - a first rocker, which is pre-arranged for being actuated by said first cam profile, - a second rocker, which is pre-arranged for being actuated by said second cam profile, and - a selector device (72, 74) for connecting selectively said master piston with said first rocker or said second rocker, - a first rocker, which is pre-arranged for being actuated by said first cam profile, - a second rocker, which is pre-arranged for being actuated by said second cam profile, and - a selector device (72, 74) for connecting selectively said master piston with said first rocker or said second rocker, - said control unit is configured for controlling said selector device so as to govern the engine valve selectively in one or other of the two operating modes, and, moreover, said control unit is configured for controlling said solenoid valve on the basis of the selected operating mode.