In this work, a hydroxyethyl-imidazoline derivate based on coffee oil has been synthesized and evaluated as an inhibitor of corrosion for carbon steel in CO2-saturated (3% NaCl + 10% diesel) emulsion at 50°C. Electrochemical impedance spectroscopy has been used to study the film formation on carbon steel. Performance of inhibitor was evaluated by adding 0, 5, 10, 25, 50, and 100 ppm. EIS data were used to calculate corrosion related electrochemical parameters, and this technique was shown to be a very useful tool for studying corrosion inhibitors. Optimal concentration is 10 ppm, by decreasing the corrosion rate by over 99.9%. Lower or higher concentrations increases the corrosion rate because the surface area covered by the inhibitor decreases, causing the formation of unprotected sites on the metal.