In the era of vast spectroscopic surveys focusing on Galactic stellar populations, astronomers want to exploit the large quantity and good quality of data to derive their atmospheric parameters without losing precision from automatic procedures. In this work, we developed a new spectral package, FASMA, to estimate the stellar atmospheric parameters (namely effective temperature, surface gravity, and metallicity) in a fast and robust way. This method is suitable for spectra of FGK-type stars in medium and high resolution. The spectroscopic analysis is based on the spectral synthesis technique using the radiative transfer code, MOOG. The line list is comprised of mainly iron lines in the optical spectrum. The atomic data are calibrated after the Sun and Arcturus. We use two comparison samples to test our method, i) a sample of 451 FGK-type dwarfs from the high resolution HARPS spectrograph, and ii) the Gaia-ESO benchmark stars using both high and medium resolution spectra. We explore biases in our method from the analysis of synthetic spectra covering the parameter space of our interest. We show that our spectral package is able to provide reliable results for a wide range of stellar parameters, different rotational velocities, different instrumental resolutions, and for different spectral regions of the VLT-GIRAFFE spectrographs, used among others for the Gaia-ESO survey. FASMA estimates stellar parameters in less than 15 min for high resolution and 3 min for medium resolution spectra. The complete package is publicly available to the community.