NOVELTY - Storing energy comprises producing hydrogen by electrolysis of water with electrical current, additionally producing carbon dioxide, and producing methane by methanization from hydrogen and carbon dioxide. The method comprises e.g. (a) producing carbon dioxide in a biogas plant for the production of carbon dioxide and methane comprising biogas, (b) separating the carbon dioxide and methane in the produced biogas into a methane-rich gas stream and a carbon dioxide-rich gas stream, (c) storing, removing and supplying the methane-rich gas stream into a natural gas system.    USE - The method is useful for storing energy.    ADVANTAGE - The method: provides methane with desired purity by utilizing only one gas separation membrane; and balances the fluctuations in the output of a current source, e.g. plant for the production of renewable energy from wind and solar energy in a cost efficient manner.    DETAILED DESCRIPTION - Storing energy comprises producing hydrogen by electrolysis of water with electrical current, additionally producing carbon dioxide, and producing methane by methanization from hydrogen and carbon dioxide. The method comprises (a) producing carbon dioxide in a biogas plant for the production of carbon dioxide and methane comprising biogas through fermentation of biomass by gasification, (b) separating the carbon dioxide and methane in the produced biogas into a membrane separation system by means of selective gas separation membranes into a methane-rich gas stream and a carbon dioxide-rich gas stream, (c) storing, removing and supplying the methane-rich gas stream into a natural gas system, supplying carbon dioxide-rich gas stream for methanation and mixing and reacting with hydrogen generated by water electrolysis to obtain methane, carbon dioxide and hydrogen comprising product gas, (c) separating at least a separated part of the product gas of methanation in a membrane separation system for selectively separating carbon dioxide and hydrogen from methane, and (d) carrying out both the separation of the biogas and the separation of the product gas of the methanation simultaneously or alternately in the same membrane separation system using gas separation membranes for selective removal of carbon dioxide and hydrogen from methane. An INDEPENDENT CLAIM is also included for an energy-storage system operated by the above method comprising at least one power source (1), at least one hydrogen production plant (2) for production of hydrogen by water electrolysis, at least one plant (3) for the production of carbon dioxide, at least one methanization plant (4) for production of methane from hydrogen and carbon dioxide, optionally a gas storage (5) for the generated gases, optionally power generation plant for the production of electric current by combustion of produced methane, and an agent for conducting electrical current and corresponding gas streams from one plant to another, or to and from the gas storage or for introducing into a natural gas system, where (i) the plant for the production of carbon dioxide is a plant for the production of carbon dioxide and methane comprising biomass by fermentation of biomass or gasification, (ii) the plant for the production of carbon dioxide is connected downstream to the membrane separation system, which is capable of the selective removal of carbon dioxide and hydrogen from the produced methane, (iii) the agent for conducting at least a part of the product gas from methanization plant is provided at the membrane separation system, and (iv) the agent for recycling carbon dioxide and/or hydrogen separated in methanization system are provided to the methanization plant.    DESCRIPTION OF DRAWING(S) - The figure shows a schematic process flow of the method.    Power source (1)    Hydrogen production plant (2)    Plant for the production of carbon dioxide (3)    Methanization plant (4)    Gas storage (5)