Many onshore and offshore oil and gas pipelines that will be constructed in the future may face various challenges related to the terrain or the seabed and the potential geohazards. Undoubtedly, in areas that are characterized by moderate or high seismicity, such as south-east Europe, north Africa, Middle East, etc., these challenges may be greater. The experience from the past worldwide has shown that the qualitative and especially the quantitative assessment of various geohazards, such as slope instabilities, active faults, soil liquefaction phenomena, is a key issue that may dominate the routing, the design, and the construction of an onshore or offshore pipeline. On the other hand, it is evident that, the later the problematic areas (in terms of geohazards) are identified, the more the problems may derive during the phases of design and/or construction. The current paper, after a short description of the main geohazards, describes a smart decision-support tool that has recently been developed in a geographic information system (GIS) for (a) the quantitative assessment of various geohazards along a pipeline route and (b) the consequent optimization of the pipeline routing. The tool may achieve the optimum pipeline routing, taking into consideration various criteria apart from the geohazards, such as distance minimization, avoidance of critical areas, land use, environmental constrains, etc. The tool has been verified through three case studies in south-east Europe, two onshore pipelines and one offshore pipeline. The results demonstrate the capability of the tool to manipulate, analyze, and manage all the available spatial data that are directly or indirectly related to geohazards (i.e. topographical, geological, geotechnical and seismological data) and to support the geoscientists and the pipeline engineers to avoid all the problematic areas as soon as possible.