The invention relates to a method and an apparatus for recovering energy in the hot fill of a liquid food product. The product is heat treated in a first section (5) of a heat exchanger (4) and is held at this temperature during a certain time interval. The temperature of the product is adapted to the hot-fill temperature in a second section (8) of the heat exchanger (4). The product is hot-filled in a filling machine (10) and the product surplus from the filling machine (10) is cooled in a fourth section (15) of the heat exchanger (4). The product surplus is finally cooled in a third section (12) of the heat exchanger (4) and recycled to production.