Scripture (Hebrews 2: 18; 4: 15) says Jesus was tempted in all things as we are. And according to Matthew 4: 1-11, Jesus was tempted directly by the devil. It appears to me that the key word in the verse is “by.” In other words, the temptation came from outside of Jesus. A lure was dangled in front of Jesus to do something wrong.
Still, what gave the devil hope that he could successfully tempt Jesus, knowing that Jesus was God who cannot be tempted? The devil directed his tactics towards the human nature of Jesus. Aware that certain physical and psychological needs, including vanity, are a natural part of the human makeup, he knew that if he could stir those conditions within Jesus, it would lead to Jesus becoming a sinner.
However, Jesus was not tempted to grab hold of Satan’s bait. Within Jesus’ human nature, there wasn’t desire, compulsion, or lust for that presented by Satan. Had there been, and acted upon; according to James 1: 14, 15, sure enough His mission as our Savior would have been thwarted. Instead, there wasn’t any consideration given to Satan’s suggestions. Jesus didn’t entertain them for a moment, which if He had, would’ve started a wrongful process. His immediate counter, of course, was the Word of God.
Speaking of which, it’s the 13th verse of James 1 that says God cannot be tempted. That’s because unlike Jesus’ humanity, there is nothing potentially negative within Him for any external force to appeal to. The all-sufficient God doesn’t possess any unmet needs.