A method for controlling an internal combustion engine, and an internal combustion engine, having at least one cylinder (1), a reciprocating piston (16) arranged in the cylinder (1), a combustion chamber (15) delimited by the cylinder (1) and the piston (16), and inlet and outlet valves (2, 3) that are controlled by a computer-based control system (5). The combustion engine includes elements (10) for injecting water or water steam into the combustion chamber (15), and the control system (5) is arranged to control the inlet and outlet valves (2, 3) and the elements (10) for injection of water or water steam such that power strokes that are mainly based on expanding combustion gases are alternated with power strokes that are mainly based on expanding water steam.