Focusing on Jesus instead of ourselves. Taking captive every wrong feeling and wrong thought and sending them away. It takes an active mind, not passive, and prayer. That's it. You can't be tempted of something you don't want. I don't want alcohol so I can't be tempted with it. God can change your desires.
Be alert to testimonies of believers who have been led through a path of obedience from discouragement and perhaps despair.
Some Bible verses that have helped me answer this question for myself are 2 Corinthians 10:5, from which Abdicate posting just above is inspired. If you read that passage within its context, it talks about Paul working very hard to make every person's thought captive to Jesus Christ. Thinking on this verse in light of other passages of Scriptures, such as Philippians 4:8 and 1 Peter 2:1-2 led me to apply 2 Corinthinans 10:5 to my thought world, which affects my emotions...
Sin can hinder our desire from feeding on God's Word (1 Pi 2:1), but that's an important part of where growth comes from.