This effort shares the analysis of problem solving associated with mechanical damage to pipelines. It proposes the method of prevention accidental oil spills during earth excavation using electromagnetic sensors. The advantages of this method versus alternative options are described herein. It presents the review of existing sensors and methods of their installation on the operating member of excavation equipment. An optimal design solution has been developed that ensures trouble-free earth excavation. It shows the economic effect of implementation of this technology into the production processes of the oil and gas sector companies. The conclusions are formulated and summed up on the data presented