Now the works of the flesh are evident, which are: adultery, fornication, uncleanness, lewdness, idolatry, sorcery, hatred, contentions, jealousies, outbursts of wrath, selfish ambitions, dissensions, heresies, envy, murders, drunkenness, revelries, and the like… Galatians 5:19-21 (NKJV)
The works of the flesh are the outcome of relying on the flesh.
So the only way to avoid the works of the flesh is actually not fighting to stop doing them but laboring to not rely on the flesh. Whatever sin whether bad behavior or addiction that a person is struggling with, the implication is that this person is in bondage to something that’s stronger than his will power, and his self determination to do right. Even when he hates what he’s doing, even when he doesn’t intend to do it, even when he fights not to do it he finds himself ending up doing it! Romans 7:15-25. This is the flesh. Every time we try to will and do anything good in our own human effort apart from God we are acting in the flesh. The results are the works mentioned in Galatians 5:19-21.
But when we rest by believing in Christ and who we are in Him the result is the fruit of the spirit mentioned in Galatians 5:22-23.
We avoid the works of the flesh by looking to Christ as our ability. This we do by hearing and hearing His Word. Romans 10:17. The Word produces Faith in us by which we effortlessly bear the fruit of the spirit.