Method for the sterilization or pasteurization of products filled into containers by heating while using a system which comprises multiple consecutive treatment zones in a transport direction of the containers which form heating zones zones of a pasteurization region and cooling zones and in which zones the respective containers are impinged with a liquid treatment medium the temperature of which increases from zone to zone in the pre heating zones with respect to the transport direction reaches a sterilization or pasteurization temperature in zones of the pasteurization area and decreases from zone to zone in the cooling zones with respect to the transport direction wherein the thermal energy of the treatment medium accumulating during the treatment at a low temperature level is used by means of at least one heat pump to heat the treatment medium to a higher temperature level.