A method for liquefying gaseous methane, in which: - a source of gaseous methane is provided, producing a flow of gaseous methane 5 at a temperature T1 and at a pressure P1, - a source of liquid nitrogen is provided, producing a flow of liquid nitrogen at a pressure P2 and at a temperature T2 which is lower than the temperature of the triple point of methane, - in a first exchanger, the flow of gaseous methane 10 at temperature T1 is cooled, as a counter-current, to a temperature T3 corresponding to that of its dew point by the exchange of heat with a flow of gaseous nitrogen at temperature T4 originating from a phase separator drum, - the flow of gaseous methane at temperature T3 is transferred into a second counter-current exchanger, - the flow of liquid nitrogen at temperature T2 is transferred from the source of liquid nitrogen to the phase separator drum, - a temperature T4 which is higher than the temperature of the triple point of methane and a pressure P4 are applied in the phase separator drum in such a manner that a liquid phase at temperature T4 producing a flow of liquid nitrogen and a vapour phase at temperature T4 producing a flow of gaseous nitrogen are present inside said drum, - in the second exchanger, the flow of gaseous methane at temperature T3 is liquefied, thereby producing a flow of liquid methane at temperature T5 by vaporization of the flow of liquid nitrogen at temperature T4, thereby producing a flow of vaporized nitrogen at temperature T4, - the flow of vaporized nitrogen at temperature T4 is transferred into the separator drum, - the flow of liquid methane at temperature T5 is transferred to and then stored in a storage tank containing a liquid methane phase and a gaseous methane phase; said gaseous methane phase escaping from said storage tank, thereby forming a methane leakage flow, characterized in that - the methane leakage flow at temperature T5 is directed into the first exchanger as a counter-current to the flow of gaseous methane at temperature T1, and as a co-current with the flow of gaseous nitrogen at temperature T4, thereby contributing to cooling said flow of gaseous methane. - a source of gaseous methane is provided, producing a flow of gaseous methane 5 at a temperature T1 and at a pressure P1, - a source of liquid nitrogen is provided, producing a flow of liquid nitrogen at a pressure P2 and at a temperature T2 which is lower than the temperature of the triple point of methane, - in a first exchanger, the flow of gaseous methane 10 at temperature T1 is cooled, as a counter-current, to a temperature T3 corresponding to that of its dew point by the exchange of heat with a flow of gaseous nitrogen at temperature T4 originating from a phase separator drum, - the flow of gaseous methane at temperature T3 is transferred into a second counter-current exchanger, - the flow of liquid nitrogen at temperature T2 is transferred from the source of liquid nitrogen to the phase separator drum, - a temperature T4 which is higher than the temperature of the triple point of methane and a pressure P4 are applied in the phase separator drum in such a manner that a liquid phase at temperature T4 producing a flow of liquid nitrogen and a vapour phase at temperature T4 producing a flow of gaseous nitrogen are present inside said drum, - in the second exchanger, the flow of gaseous methane at temperature T3 is liquefied, thereby producing a flow of liquid methane at temperature T5 by vaporization of the flow of liquid nitrogen at temperature T4, thereby producing a flow of vaporized nitrogen at temperature T4, - the flow of vaporized nitrogen at temperature T4 is transferred into the separator drum, - the flow of liquid methane at temperature T5 is transferred to and then stored in a storage tank containing a liquid methane phase and a gaseous methane phase; said gaseous methane phase escaping from said storage tank, thereby forming a methane leakage flow, characterized in that - the methane leakage flow at temperature T5 is directed into the first exchanger as a counter-current to the flow of gaseous methane at temperature T1, and as a co-current with the flow of gaseous nitrogen at temperature T4, thereby contributing to cooling said flow of gaseous methane.