The Solar System was formed around 4670 million years ago from a cloud of gas an dust which formed the central star and a circumstellar disk. The current structure of our solar system with the rocky planets in the inside, like Earth and Mars, and the formation of giant exterior planets like Jupiter and Saturn, speaks to us about the physical processes that took place in that time when our planetary system took shape. In parallel, the astrophysicist are obtaining a growing number of observations from similar disks around very young stars that allow us to study live the formation of planets in those stars. In our Solar System the exterior planets (the gas giants Jupiter and Saturn, and the frozen giants Uranus and Neptune) formed rapidly due to an abundance of light materials acquiring enough mass to attract hydrogen gas of the protosolar nebula and gravitationally dominate its surroundings. The interior planets took much longer to form due to a lower amount of condensable materials in the temperature conditions that existed in the interior Solar System, with and estimated range of time between 50 and 100 million years to have the interior Solar System fully formed. This formation of the interior solar system was dominated by violent collisions between thousands of protoplanets and billions of much smaller planetesimals. In this conference we will make special emphasis on the details of the formation of the terrestrial planets, and the Earth-Moon system in particular, which was formed as a consequence of one of those planetary impacts.