It is both. Think of producing a composition, like it's a cake or a recipe. Each component has to work with the other, otherwise we end up with a spinach and coffee cake with beetroot icing...and yes I'm sure there are some hippie shops that make this kind of 'treat'.
What you nees to do is approach each layer with some knowledge of how the cake...sorry :), I mean composition will sound at the end. For example, the first layer is how the individual elements of the composition sits together ad an arrangement. Think about frequency response, do ypu need 5 kick drums, 10 bass guitars and an opera baritone? This will also help when mixing and carving out a spot in the mix via frequency shaping or EQ. This is tip one in getting a polished mix.
Beyond the initial composing and tracking, and of course EQing, there's also gain staging and dynamic range. As a tip, i like to have the gain stage of each of my tracks at -18rms, and from there lower or add more volume depending on whether the instrument is a lead or a secondary sound. Then there are things like verb and other time based delay effects, which can also help seperate the mix.
Then if you use digital only, there's the analogue emulation aesthetic, you literally have to add in what was taken for granted with analogue.
Finally mastering, is the track a simple acoustic track or a full on orchestra with a 100 instruments and massive dynamic range.
Unfortunately to answer the Op question, unless you want to trust your work to some of the automated mixing software and mastering software that is emerging - then to achieve what you want takes practice and possibly years of practice...unless you can find someone to teach you the ins and outs of what I've just written.