A method for optimizing the driving of a pile, the method comprising: - driving the pile into the ground by a pile-driving machine comprising a hammer ram to be placed against the pile and a block that is movable back and forth therein; - moving the block applied for driving the pile towards the end of the pile with a given impact energy (W kin); the method being characterized by the following steps: - determining the value of a kinetic variable of the impact, proportional to the kinetic energy of the block used for driving the pile, when the block is moving towards the pile in the pile driving direction; - determining the value of a kinetic variable of the return motion, proportional to the kinetic energy of the block, when the block is returning, after an impact on the pile, in a direction opposite to the pile driving direction; - calculating a kinetic variable ratio (Q1/Q3) by means of the determined kinetic variable of the impact and kinetic variable the return motion; - comparing the obtained kinetic variable ratio (Q1/Q3) with a predetermined target value (Q1/Q3 tav) for the kinetic variable ratio (Q1/Q3), producing the shortest possible total pile driving time (t tot) for the pile; - adjusting the impact energy (W kin) of the next impact in such a way that the kinetic variable ratio (Q1/Q3) determined by the kinetic variable of the impact and the kinetic variable of the return motion of the next impact will be changed towards the target value (Q1/Q3 tav). - driving the pile into the ground by a pile-driving machine comprising a hammer ram to be placed against the pile and a block that is movable back and forth therein; - moving the block applied for driving the pile towards the end of the pile with a given impact energy (W kin); the method being characterized by the following steps: - determining the value of a kinetic variable of the impact, proportional to the kinetic energy of the block used for driving the pile, when the block is moving towards the pile in the pile driving direction; - determining the value of a kinetic variable of the return motion, proportional to the kinetic energy of the block, when the block is returning, after an impact on the pile, in a direction opposite to the pile driving direction; - calculating a kinetic variable ratio (Q1/Q3) by means of the determined kinetic variable of the impact and kinetic variable the return motion; - comparing the obtained kinetic variable ratio (Q1/Q3) with a predetermined target value (Q1/Q3 tav) for the kinetic variable ratio (Q1/Q3), producing the shortest possible total pile driving time (t tot) for the pile; - adjusting the impact energy (W kin) of the next impact in such a way that the kinetic variable ratio (Q1/Q3) determined by the kinetic variable of the impact and the kinetic variable of the return motion of the next impact will be changed towards the target value (Q1/Q3 tav). - determining the value of a kinetic variable of the impact, proportional to the kinetic energy of the block used for driving the pile, when the block is moving towards the pile in the pile driving direction; - determining the value of a kinetic variable of the return motion, proportional to the kinetic energy of the block, when the block is returning, after an impact on the pile, in a direction opposite to the pile driving direction; - calculating a kinetic variable ratio (Q1/Q3) by means of the determined kinetic variable of the impact and kinetic variable the return motion; - comparing the obtained kinetic variable ratio (Q1/Q3) with a predetermined target value (Q1/Q3 tav) for the kinetic variable ratio (Q1/Q3), producing the shortest possible total pile driving time (t tot) for the pile; - adjusting the impact energy (W kin) of the next impact in such a way that the kinetic variable ratio (Q1/Q3) determined by the kinetic variable of the impact and the kinetic variable of the return motion of the next impact will be changed towards the target value (Q1/Q3 tav).