Process for preparing an ester by carbonylation of a C2 to C16 hydrocarbon, with the process comprising the following steps: a) reacting (carbonylating) a C2 to C16 hydrocarbon having at least one olefinic double bond with carbon monoxide and with an alcohol that is a mono- or polyol (two or more OH groups) having 1 to 50 carbon atoms or is a mixture of two or more mono- and/or polyols and which, when it is a monool, is used in a molar ratio to the C2 to C16 hydrocarbon (alcohol:C2 to C16 hydrocarbon) of 2 to 20 or which, when it is a polyol, is used in a molar ratio to the hydrocarbon used (hydrocarbon:polyol) of 2 to 20, in the presence of a homogeneous catalyst system comprising at least one metal of groups 8 to 10 of the periodic table of the elements or a compound thereof, a phosphorus-containing ligand and an acid, in a reaction zone to obtain a liquid product mixture that comprises at least the ester formed by the reaction, the homogeneous catalyst system, low boilers, high boilers and unreacted alcohols; b) carrying out a membrane separation to separate the homogeneous catalyst system from the liquid product mixture, whereby the homogeneous catalyst system and additionally unreacted hydrocarbon and/or unreacted alcohol, preferably unreacted alcohol, are enriched in the retentate and the ester formed in step a) is enriched in the permeate, wherein the membrane material used is an OSN (organic solvent nanofiltration) membrane material that is acid-stable, i.e. stable in the presence of the acid of the catalyst system for at least 300 h, and has at least one separation-active layer, which is composed of PEEK (polyether ether ketone), and the retentate is recycled into the reaction zone; c) working up the permeate by means of one or more separation steps selected from thermal separation, extraction, crystallization or membrane separation, preferably by means of one or more distillation steps, for removing the ester formed in step a) and for removing the unreacted C2 to C16 hydrocarbon having at least one olefinic double bond and/or the unreacted alcohol and recycling of the unreacted C2 to C16 hydrocarbon having at least one olefinic double bond and/or of the unreacted alcohol into the reaction zone of step a). a) reacting (carbonylating) a C2 to C16 hydrocarbon having at least one olefinic double bond with carbon monoxide and with an alcohol that is a mono- or polyol (two or more OH groups) having 1 to 50 carbon atoms or is a mixture of two or more mono- and/or polyols and which, when it is a monool, is used in a molar ratio to the C2 to C16 hydrocarbon (alcohol:C2 to C16 hydrocarbon) of 2 to 20 or which, when it is a polyol, is used in a molar ratio to the hydrocarbon used (hydrocarbon:polyol) of 2 to 20, in the presence of a homogeneous catalyst system comprising at least one metal of groups 8 to 10 of the periodic table of the elements or a compound thereof, a phosphorus-containing ligand and an acid, in a reaction zone to obtain a liquid product mixture that comprises at least the ester formed by the reaction, the homogeneous catalyst system, low boilers, high boilers and unreacted alcohols; b) carrying out a membrane separation to separate the homogeneous catalyst system from the liquid product mixture, whereby the homogeneous catalyst system and additionally unreacted hydrocarbon and/or unreacted alcohol, preferably unreacted alcohol, are enriched in the retentate and the ester formed in step a) is enriched in the permeate, wherein the membrane material used is an OSN (organic solvent nanofiltration) membrane material that is acid-stable, i.e. stable in the presence of the acid of the catalyst system for at least 300 h, and has at least one separation-active layer, which is composed of PEEK (polyether ether ketone), and the retentate is recycled into the reaction zone; c) working up the permeate by means of one or more separation steps selected from thermal separation, extraction, crystallization or membrane separation, preferably by means of one or more distillation steps, for removing the ester formed in step a) and for removing the unreacted C2 to C16 hydrocarbon having at least one olefinic double bond and/or the unreacted alcohol and recycling of the unreacted C2 to C16 hydrocarbon having at least one olefinic double bond and/or of the unreacted alcohol into the reaction zone of step a).