The near-Earth object (NEO) population includes both asteroids (NEAs) and comet nuclei (NECs) whose orbits have perihelion distances q<1.3 AU and which can approach or cross that of the Earth. A NEA is defined as a “potentially hazardous asteroid” (PHA) for Earth when its minimum orbit intersection distance (MOID) comes inside 0.05 AU and it has an absolute magnitude H<22 mag (i.e. mean diameter > 140 m). These are big enough to cause, in the case of impact with Earth, destructive effects on a regional scale. Smaller objects can still produce major damage on a local scale, while the largest NEOs could endanger the survival of living species. Therefore, several national and international observational efforts have been started (i) to detect undiscovered NEOs and especially PHAs, (ii) to determine and continuously monitor their orbital properties and hence their impact probability, and (iii) to investigate their physical nature. Further ongoing activities concern the analysis of possible techniques to mitigate the risk of a NEO impact, when an object is confirmed to be on an Earth colliding trajectory. Depending on the timeframe available before the collision, as well as on the object’s physical properties, various methods to deflect a NEO have been proposed and are currently under study from groups of experts on behalf of international organizations and space agencies. This paper will review our current understanding of the NEO population, the scientific aspects and the ongoing space- and ground-based activities to foresee close encounters and to mitigate the effects of possible impacts.