There is an overall consensus that the majority of the time EQ should be placed before compression.
So, EQ > Compression
However there are no set rules and if you do find yourself EQing after you compress then the typical use in that scenario would be to cut with an EQ before your compressor and then boost with an EQ after your compressor
EQ (Cut) > Compressor > EQ (Boost)
When you become comfortable with compressors and EQs the above chain actually makes it easier to shape your sound even more dramatically.
But don’t be misled, if all you mastered was the EQ > Compression combo, you would still be in the top 1% of mixers.