I was reading an article about the recording of the Beatles' Sgt. Pepper, as related in the book of Geoff Emerick, the Beatles' recording engineer. He said the difference between the "Revolver" and the "Sgt. Pepper" albums is the fact that the sonic quality of the latter was more superior due to two important factors. The studio used in Sgt. Pepper was a bigger Studio II, which was able to "capture" all the nuances of various highs and low frequencies, compared to Studio III where "Revolver" was recorded. Studio III is much smaller as compared to II's capability of handling full orchestras. The second factor is equipment. Seems that Studio II had better sounding preamps and mixers, although both use the same brand of mixer, EMI's Redd X (?) and tube Neumann mics. So, from what he is saying, the recording space takes a lot of importance - big, acoustically well treated rooms with good sonic response, and definitely professionally "tuned" equipment - preamps, mixers, recorders, etc.
Others include budget, talent, creativity, knowledge and definitely ears.