Method for preventing condensate in the oil of an oil-injected compressor comprising an oil-injected compressor element with an inlet that can be closed by means of a controlled inlet valve and an outlet ; a drive for the compressor element ; an oil circuit comprising an oil separator with an input that is connected to the outlet of the compressor element and an output to which a consumer network for compressed gas can be connected, whereby this oil separator comprises a pressure vessel in which the oil separated from the compressed gas is received and from where oil can be injected into the compressor element ; a controller for the drive of the compressor element that is such that when the pressure (p) in the consumer network has reached a set maximum value (pmax), the drive of the compressor element is stopped according to a set stop program , wherein before the drive of the compressor element is stopped when the maximum pressure (pmax) in the consumer network has been reached, the method comprises the following steps: - the determination of the temperature (T) of the compressed gas; - when this temperature (T) is higher than a set fixed or calculated minimum value (Tmin) to prevent condensate in the oil, the stopping of the drive of the compressor element according to the set stop program ; - when this temperature (T) is lower than the aforementioned set fixed or calculated minimum value (Tmin), the drive is not immediately stopped but continues to drive with an open inlet valve according to a recirculation program in the controller in order to continue compressing gas and recirculate this compressed gas from the oil separator via a recirculation pipe in which a throttle and a controlled normally closed closable recirculation valve is incorporated to the inlet of the compressor element in order to raise the temperature (T) until the aforementioned fixed or calculated minimum temperature (Tmin) is reached and then to stop the drive , after a set minimum period (t'min) which is started when the set minimum temperature (Tmin) has been reached, according to the set stop program or after expiry of a set maximum period (tmax) if the minimum temperature (Tmin) has not been reached after this maximum period (tmax) and if during the execution of the recirculation program the temperature (T) of the compressed gas or the oil does not reach the required minimum temperature (Tmin) after the aforementioned maximum period (tmax), the stop program is executed. - the determination of the temperature (T) of the compressed gas; - when this temperature (T) is higher than a set fixed or calculated minimum value (Tmin) to prevent condensate in the oil, the stopping of the drive of the compressor element according to the set stop program ; - when this temperature (T) is lower than the aforementioned set fixed or calculated minimum value (Tmin), the drive is not immediately stopped but continues to drive with an open inlet valve according to a recirculation program in the controller in order to continue compressing gas and recirculate this compressed gas from the oil separator via a recirculation pipe in which a throttle and a controlled normally closed closable recirculation valve is incorporated to the inlet of the compressor element in order to raise the temperature (T) until the aforementioned fixed or calculated minimum temperature (Tmin) is reached and then to stop the drive , after a set minimum period (t'min) which is started when the set minimum temperature (Tmin) has been reached, according to the set stop program or after expiry of a set maximum period (tmax) if the minimum temperature (Tmin) has not been reached after this maximum period (tmax) and if during the execution of the recirculation program the temperature (T) of the compressed gas or the oil does not reach the required minimum temperature (Tmin) after the aforementioned maximum period (tmax), the stop program is executed. <EOS>