Immediately the Spirit drove Him into the wilderness. And He was there in the wilderness forty days, tempted by Satan, and was with the wild beasts; and the angels ministered to Him. (Mark 1.12-13)
Note the first word of verse 12. Mark uses his signature adverb, immediately. This is a fast-paced portrait of Christ. The temptation by Satan highlights the humanity of Christ. He will be tempted and succeed where Adam had failed. Satan is the great adversary of man and God. Satan stands opposed to the plan and purpose of God. Therefore, Satan tempts but God tests. The Son of God was manifested for a significant purpose: To destroy the works of the devil (1 John 3.8). R. A. Guelich wrote:
The contrasting disobedience of Adam and the obedience of Christ occurs in the familiar passage of Rom 5:12–21 (cf. Luke 3:38; 1 Cor 15:22, 45–49). Whereas Adam succumbed to his tempter resulting in hostility within creation and hardship in his own life, Jesus overcame the tempter, restored harmony within the creation, and lived by God’s sustenance as a sign of the new creation. Jesus is the second Adam, the obedient one.
R. K. Hughes aptly points out that Heaven had opened and now Hell opens. Satan tempts Jesus for 40 days. Israel lingered in the wilderness for 40 years, Moses was upon Mount Sinai for 40 days and nights, and Elijah was led to Mount Horeb for 40 days and nights. The wilderness was a place of testing (God) and temptation (Satan) in each case. Would Israel remain faithful? They ultimately were not faithful. Jesus succeeds where both Adam and Israel failed.
It’s important to mention that God ministered to Jesus through the angels. He did so throughout the testing/temptation and not just at the end of it (imperfect tense of ministered).
Jesus was tempted. People wonder how He could have been tempted since He was God. My answer is always the same: As God, He could not have been tempted; as man, He was tempted. R. C. H. Lenski wrote:
The greatness of the strength tested changes nothing about the reality of the test to which it is subjected. The strain applied is just as real when the strength endures it as when the strength is too weak to endure it. Jesus as the Stronger stood unmoved under all the force that Satan, the strong one, could bring to bear against him. Was it possible that the Stronger should go down before the strong in a test of strength? Thus the test or temptation was real in every way and no illusion. 
It is because of Jesus’ strength that we can endure our own temptations. We can choose the way of escape. We do not have to sin.
No temptation has overtaken you except such as is common to man; but God is faithful, who will not allow you to be tempted beyond what you are able, but with the temptation will also make the way of escape, that you may be able to bear it. (1 Corinthians 10.13)
 Guelich, R. A. (2002). Vol. 34A: Word Biblical Commentary : Mark 1-8:26. Word Biblical Commentary (39). Dallas: Word, Incorporated.
 Lenski, R. C. H. (1961). The Interpretation of St. Mark’s Gospel (61). Minneapolis, MN: Augsburg Publishing House.