We report the first global, time-dependent simulation of the Mars upper atmospheric responses to a realistic solar flare event, an X8.2 eruption on 10 September 2017. The Mars Global Ionosphere-Thermosphere Model runs with realistically specified flare irradiance, giving results in reasonably good agreement with the Mars Atmosphere and Volatile EvolutioN spacecraft measurements. It is found that the ionized and neutral regimes of the upper atmosphere are significantly disturbed by the flare but react differently. The ionospheric electron density enhancement is concentrated below ~110-km altitude due to enhanced solar X-rays, closely following the time evolution of the flare. The neutral atmospheric perturbation increases with altitude and is important above ~150-km altitude, in association with atmospheric upwelling driven by solar extreme ultraviolet heating. It takes ~2.5 hr past the flare peak to reach the maximum disturbance and then additional ~10 hr to generally settle down to preflare levels.