Method for enhanced recovery of hydrocarbons contained in an underground porous medium, by means of a technique of flushing the medium with an aqueous solution comprising at least one chemical intended to improve the flushing of said medium, in which an amount of alkaline agent is additionally introduced to limit the adsorption of said chemical, characterized in that the amount of alkaline agent to be injected is determined by carrying out the following steps: A) modelling a change in the pH in said porous medium following the injection of an amount of alkaline agent solution into said medium, said alkaline agent being a base that makes it possible to obtain a buffer effect, using a flow simulator that models a transport of sodium hydroxide through said porous medium, by carrying out the following steps: - considering the alkaline agent to be a pseudo-sodium hydroxide constituent, having a concentration equal to an OH - concentration corresponding to the pH of said alkaline agent solution injected; - using an equation for adsorption of the OH - ions, dependent on parameters to be calibrated, this equation being calibrated on experimental data in order to determine an amount of pseudo-sodium hydroxide constituent adsorbed from the concentration of the pseudo-sodium hydroxide constituent; - modelling the change in the pH by modelling the transport of the alkaline agent solution using said sodium hydroxide transport simulator, replacing the sodium hydroxide with the pseudo-sodium hydroxide constituent; B) repeating said modelling of the change in the pH for various amounts of alkaline agent solution injected; C) choosing the amount of alkaline agent solution to be added in order to optimize the enhanced recovery of hydrocarbons. A) modelling a change in the pH in said porous medium following the injection of an amount of alkaline agent solution into said medium, said alkaline agent being a base that makes it possible to obtain a buffer effect, using a flow simulator that models a transport of sodium hydroxide through said porous medium, by carrying out the following steps: - considering the alkaline agent to be a pseudo-sodium hydroxide constituent, having a concentration equal to an OH - concentration corresponding to the pH of said alkaline agent solution injected; - using an equation for adsorption of the OH - ions, dependent on parameters to be calibrated, this equation being calibrated on experimental data in order to determine an amount of pseudo-sodium hydroxide constituent adsorbed from the concentration of the pseudo-sodium hydroxide constituent; - modelling the change in the pH by modelling the transport of the alkaline agent solution using said sodium hydroxide transport simulator, replacing the sodium hydroxide with the pseudo-sodium hydroxide constituent; - considering the alkaline agent to be a pseudo-sodium hydroxide constituent, having a concentration equal to an OH - concentration corresponding to the pH of said alkaline agent solution injected; - using an equation for adsorption of the OH - ions, dependent on parameters to be calibrated, this equation being calibrated on experimental data in order to determine an amount of pseudo-sodium hydroxide constituent adsorbed from the concentration of the pseudo-sodium hydroxide constituent; - modelling the change in the pH by modelling the transport of the alkaline agent solution using said sodium hydroxide transport simulator, replacing the sodium hydroxide with the pseudo-sodium hydroxide constituent; B) repeating said modelling of the change in the pH for various amounts of alkaline agent solution injected; C) choosing the amount of alkaline agent solution to be added in order to optimize the enhanced recovery of hydrocarbons.