The invention relates to a system (1) and a method for pasteurizing foods packed in closed containers (2). The containers (2) are supplied with a processing liquid (11) in at least one heating zone (5,6), at least one pasteurization zone (7, 8), and at least one cooling zone (9, 10). In order to cool and heat the processing liquid (11) as needed, a coolant (23) is cooled by means of a heat pump (22) in a cooling circuit (20), and a heating medium (33) is heated by means of the heat pump (22) in a heating circuit via a respective heat exchanger (19, 30) in each case. In order to provide cooling energy, the cooled coolant (23) is introduced into a lower end region of a cold buffer store (24), and in order to provide heating energy the heated heating medium (33) is introduced into an upper end region of a heat buffer store (35).