Overcoming the temptation is a victory in itself! The devil will always tempt us, that's what he does. The important thing is to fight back. There are many ways to endure a temptation until it passes. One way, already stated, is by reading your bible. I find my greatest comfort in the book of Psalms. Another way is to find a mantra to say. This is one that I use: (breathe in and think) Lord Jesus Christ, (breathe out & think) Son of God, (breathe in) Have mercy on me, (breathe out) a sinner. I do this, either mentally or outloud, several times until I feel calm and strength wash through me. Another thing I do (I believe in multipule strategies!) is positive thinking/speaking. Temptations are negative in nature so finding the positive to state helps. One simple example is soda cravings. The craving hits and I'm tempted to get a soda (I'm cutting back) what I do is say "I do not need soda, I'm fine." The negative is the message that soda is a need that cannot be avoided, the positive is the fact that it isn't a need and that I'm in control.
And of course; pray, pray, pray! In all things, whether big or small, pray!