A method for the avoidance of one or more terrain obstacles by a rotary-wing aircraft , comprising a warning system capable of generating alerts (CAUTION, WARNING) as a function in particular of the proximity of the terrain obstacle(s), and an electronic avoidance system , the method being implemented by the electronic avoidance system , the method comprising the following step: a) generating an alert (CAUTION, WARNING) by the warning system on detection of a terrain obstacle, characterized in that it further comprises the following steps: b) if no manual avoidance manoeuver is detected for a time longer than a first determined time (T) effective from issue of the alert (CAUTION, WARNING) by the warning system and if the alert is maintained during this first period of time (T), automatic activation of an automatic avoidance guide mode to determine a terrain obstacle-avoidance guidance law, said determination of the guidance law comprising the determination of at least one speed and/or heading set-point (IAS_cons, VZ_cons, CAP_cons) and the computing of the avoidance guidance law as a function of the determined set-point(s) (IAS_cons, VZ cons, CAP cons); and c) if an autopilot device of the aircraft is coupled to the automatic avoidance guide mode, that is to say if said automatic avoidance guide mode is activated and transmits its commands to the autopilot device , transmission to the autopilot device of the avoidance guidance law determined at step b) for automatic performing of a manoeuver to avoid the obstacle by action on one and/or the other of two primary control members of the aircraft causing the aircraft to reach the set-point(s) (IAS_cons, VZ cons, CAP cons), the warning system being capable of generating alerts of at least a first (CAUTION) and second (WARNING) type, step b) only being implemented in the event that the alert generated by the warning system is an alert of second type (WARNING) one of the determined set-points is an air speed or ground speed set-point (IAS_cons) comprising a longitudinal component perpendicular to a vertical axis, and determination comprises comparing the current air or ground speed (IAS_mes) of the aircraft with the best climb speed (Vy) and selecting the current air or ground speed (IAS_mes) as air or ground speed set-point (IAS_cons) if the current air or ground speed (IAS_mes) is lower than the best climb speed (Vy), and if not selecting the best climb speed (Vy). a) generating an alert (CAUTION, WARNING) by the warning system on detection of a terrain obstacle, b) if no manual avoidance manoeuver is detected for a time longer than a first determined time (T) effective from issue of the alert (CAUTION, WARNING) by the warning system and if the alert is maintained during this first period of time (T), automatic activation of an automatic avoidance guide mode to determine a terrain obstacle-avoidance guidance law, said determination of the guidance law comprising the determination of at least one speed and/or heading set-point (IAS_cons, VZ_cons, CAP_cons) and the computing of the avoidance guidance law as a function of the determined set-point(s) (IAS_cons, VZ cons, CAP cons); and c) if an autopilot device of the aircraft is coupled to the automatic avoidance guide mode, that is to say if said automatic avoidance guide mode is activated and transmits its commands to the autopilot device , transmission to the autopilot device of the avoidance guidance law determined at step b) for automatic performing of a manoeuver to avoid the obstacle by action on one and/or the other of two primary control members of the aircraft causing the aircraft to reach the set-point(s) (IAS_cons, VZ cons, CAP cons), <EOS>