Disclosed is a method and an apparatus for continuously sterilizing water for spraying the pistons in a piston pump or a homogenizer. The heating takes place in a first stage in a first heat exchanger (3) and in a second stage in a second heat exchanger (5). The first heat exchanger (3) operates regeneratively so that incoming cold water is heated in the first heat exchanger (3) by water which has been heated by steam in the second heat exchanger. After the second heat exchanger (5) the water is at a temperature of at least 1210°C and is to stay at this temperature in a holding cell (8) during a predetermined period of time. After the water has been cooled regeneratively in the first heat exchanger (3) it is to be at a temperature which exceeds 75°C.