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 (52, 54) 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 (42, 44) 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; wherein: - said camshaft or a further camshaft has a second cam profile for governing said valve in a two-stroke operating mode; - said hydraulic apparatus comprises a second master piston that can be actuated by said second cam profile and that is designed to drive said slave piston (52, 54) by means of a second volume of fluid set between said second master piston and said slave piston; - said solenoid valve is configured for assuming a state in which said second volume of fluid is set in communication with an outlet so as to render said slave piston independent from the movement of said second master piston; and - said control unit is configured for controlling said solenoid valve so as to govern said engine valve selectively in one or other of said two operating modes, the two-stroke mode and the four-stroke mode, wherein said hydraulic apparatus comprises a hydraulic circuit defining: - a first chamber mobile within which is said first master piston; - a second chamber mobile within which is said second master piston; and - a third chamber (51, 53) mobile within which is said slave piston (52, 54); wherein said solenoid valve is configured for controlling the communication of said first and second chambers (47, 49) with said third chamber (51, 53) and with said outlet, and wherein said solenoid valve is configured for assuming the following states: - a first state where said first and second chambers (47, 49) are both in communication with said outlet; - a second state where said first chamber is in communication with said outlet and said second chamber is in communication with said third chamber (51, 53); and - a third state where said first chamber is in communication with said third chamber (51, 53) and said second chamber is in communication with said outlet. - a hydraulic apparatus including: - a master piston, - a slave piston (52, 54) 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 (42, 44) 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 hydraulic apparatus comprises a second master piston that can be actuated by said second cam profile and that is designed to drive said slave piston (52, 54) by means of a second volume of fluid set between said second master piston and said slave piston; - said solenoid valve is configured for assuming a state in which said second volume of fluid is set in communication with an outlet so as to render said slave piston independent from the movement of said second master piston; and - said control unit is configured for controlling said solenoid valve so as to govern said engine valve selectively in one or other of said two operating modes, the two-stroke mode and the four-stroke mode, - a first chamber mobile within which is said first master piston; - a second chamber mobile within which is said second master piston; and - a third chamber (51, 53) mobile within which is said slave piston (52, 54); - a first state where said first and second chambers (47, 49) are both in communication with said outlet; - a second state where said first chamber is in communication with said outlet and said second chamber is in communication with said third chamber (51, 53); and - a third state where said first chamber is in communication with said third chamber (51, 53) and said second chamber is in communication with said outlet.