In all the three cases where Jesus was tempted, He overcame it by The Word of God. That is the key to overcoming temptation. Meditate on His word day and night.

Matthew 4:1, Matthew 4:2, Matthew 4:3, Matthew 4:4, Matthew 4:5, Matthew 4:6, Matthew 4:7-9, Matthew 4:10 and Matthew 4:11