Jesus was tempted just like each one of us. The only difference is He did not give in to the temptation.
We tend to think about Jesus being above humanity while He lived on earth. He lived a perfect life while here, but we usually say He did this because He was God and above being tempted.
We are told in the Bible that Jesus was actually tempted in ALL things just as we are today. He was completely human and was tempted just like us. This goes to show that temptation is not a sin, but we sin when we give in to the temptation.
Jesus had such a close and intimate fellowship with His Father, that he was able to overcome all temptation and live a perfect life. Because He did this, it made Him worthy to be the perfect sacrifice for us.
Because we lost the relationship and intimate fellowship with God through the fall of Adam, we were unable to live up to the Law of the Old Testament.
Jesus fulfilled the Law. He died to take away our sins and destroy the Old Covenant. He then rose from the dead and thereby began the New Covenant of living by grace.
All of us who accept His sacrifice are now living in grace, God’s perfect gift of salvation, and we are seen as perfect and righteous in His sight because of that gift.
Our old sin nature is dead and buried, and we have been raised up as new creatures in Christ. We now have the power to overcome those temptations when they come, and to live a life pleasing to God. None of this was accomplished by our own strength or works. It is the gift of God through Christ.