A basic mastering chain looks like this:
EQ--> Compressor --> Limiter
You have to listen to what the song needs. I have heard that answer for years and I really disliked it, but it's true. Compare to commercial songs and decide.
There are countless discussions about whether you should put the eq or the compressor in front and I think this is the most useful answer: corrective compression (to make the spectral balance better) should be used before the compressor. If you use eq to color the sound (for example, make it more vintage; add warmth or flavor), you can use it after the compressor.
So now you can extend your chain to this, if necessary:
Corrective EQ --> Compressor --> Colour EQ --> Limiter
I'm still learning about mastering (and I hope I'll never stop learning) and I realize that I need much less compression than I thought of in the first place. I work mainly with electronic music and in lots of cases I don't use compression at all. Or there are other ways to be creative with compression, like saturation or using a clipper. I use parallel compression more and more these days. It doesn't destroy the dynamics like regular compression.
Sometimes it's necessary to make your songs broader. You need a stereo imager to achieve this. I put it after the compressor or the coloring eq.
If you want your song really loud, you can put a clipper before the limiter. I don't advice to make your songs really loud because it destoys the dynamics but we all know that feeling that we want our song as loud as commercial songs.