For we have not a High Priest who is unable to feel for us in our weaknesses, but one who was tempted in every respect just as we are tempted, and yet did not sin. (Hebrews 4:15)
Jesus was tempted by Satan. (Matthew 4:1, Mark 1:13, Luke 4:2)
Each person is tempted when they are lured (baited) and enticed (drawn out of righteousness) by their own desire. (James 1:14)
Desires are not the source of temptation: Satan is. Satan seeks to exploit our desires to cause his seed to conceive in us to bring forth sin and death.
Temptation is like a baited hook or trap: something desirable with a hidden hook or snare.
Temptation comes to us in the form of a thought.
Temptation may be a thought suggesting we seek to satisfy our desire using means or from sources that God does not approve. Temptation may be a thought suggesting we seek to satisfy our desire quickly instead of according to timing approved by God. Temptation may be a thought suggesting we desire or believe something not approved by God.
In all cases temptation causes us to abandon trusting God (faith) to provide what is needed to satisfy our desires or give us joy with desires he approves. It causes us to abandon weighing our steps according to what God approves (fear of the Lord) and doing, saying, thinking, desiring, and believing only those things that are pleasing to him.
When we take the bait of temptation and a desire conceives within us to satisfy our desires using means or sources God does not approve, to satisfy our desires when and how we want them satisfied, or to desire and believe things not approved by God: when such a desire conceives in us it brings forth sin that chokes the seed of the word of God in us and brings forth death.
Satan attempted to exploit Jesus’ desires and suggest means to satisfy those desires that were not pleasing to God. Jesus recognized the temptation, weighed his thoughts, words, actions, desires, and beliefs according to what pleased God and rejected the temptation.
Satan attempts to exploit our desires when he tempts us, but our desires are not the source of temptation. It is important to know that Satan will attempt to exploit our good desires. (Jesus didn’t have any bad ones.)
Interestingly, James starts his teaching on temptation with a emphatic declaration that God is not the source of temptation and then follows his teaching about temptation and desires with a warning not to be deceived regarding the source of what we need to satisfy our desires.
Do not be deceived, my beloved brethren. All good giving and every perfect gift is from God with whom there is no variation or shifting. (James 1:16)
James reminds us that God is the source for all good giving and every good gift. We must trust God to provide us what we need and what we desire. He is the only source from which our needs and desires can be satisfied in a good way.
We resist temptation two different ways. The way we are familiar with is the way Jesus resisted temptation when he was tempted. He cast down the thought and commanded the tempter to leave. It is absolutely necessary to do this and not do what the temptation is trying to get us to do. It is also necessary to do this to prevent the temptation from causing a corrupt desire to conceive in our hearts.
The second way to resist temptation is to uproot and cast out the corrupt desires that previous temptation has already caused to conceive in our hearts. These corrupt desires are a corrupt tree and they will bring forth the corrupt fruit of sin. Satan will exploit the fruit of corrupt desires with additional tempting thoughts. With the corrupt desires in place it is difficult to resist the temptation in the short run and impossible in the long run - eventually the desire will find conditions favorable enough for it to produce fruit.
Whenever temptation comes we should always ask God to confirm whether the thought is coming to us as a temptation from the tempter or is a thought being produced by a corrupt desire in our own hearts. If it is temptation we reject it. If it is coming from a corrupt desire we need to uproot the corrupt desire and cast it from our being.
Temptation is not sin
It is important to realize that temptation to disobey God is not sin. Jesus was tempted to disobey God and that temptation was not sin. Jesus did was he was supposed to do and reject the temptation. Temptation brings forth sin when it causes corrupt desire to conceive in our hearts.
Temptation to doubt
We tend to think of temptation only in terms of temptation to sin. We overlook temptation to doubt - to trust in something other than God to supply our need or back away from trusting God. This was something that tripped me up in prayer for some time. I would pray and then have a thought that questioned whether the prayer would work. I didn't recognize it as temptation and thought it was evidence that I lacked enough faith to pray successfully, so I would give up on the prayer - and my prayer would fail because I quit applying faith. Once God showed me that the thought was a temptation to doubt, I rejected the temptation and continued applying my faith in my prayer - and the prayer produced the results I prayed for.
Just like temptation to sin, whenever temptation to doubt comes we should always ask God to confirm whether the thought is coming to us as a temptation from the tempter or is a thought being produced by doubt in our own hearts. If it is temptation we reject it. If it is coming from doubt we need to work to overcome the doubt.