The observation that one hemisphere of Mars is lower and has a thinner crust than the other (the `martian hemispheric dichotomy') has been a puzzle for 30 years. The dichotomy may have arisen as a result of internal mechanisms such as convection. Alternatively, it may have been caused by one or several giant impacts, but quantitative tests of the impact hypothesis have not been published. Here we use a high-resolution, two-dimensional, axially symmetric hydrocode to model vertical impacts over a range of parameters appropriate to early Mars. We propose that the impact model, in addition to excavating a crustal cavity of the correct size, explains two other observations. First, crustal disruption at the impact antipode is probably responsible for the observed antipodal decline in magnetic field strength. Second, the impact-generated melt forming the northern lowlands crust is predicted to derive from a deep, depleted mantle source. This prediction is consistent with characteristics of martian shergottite meteorites and suggests a dichotomy formation time ~100Myr after martian accretion, comparable to that of the Moon-forming impact on Earth.