This Gospel story describing the three temptations of Jesus by the Devil is shown in Matthew 4:1-11. Before this event, John the Baptist, Jesus's cousin, baptized Him. As this occurred "the heavens were opened [for him], and he saw the Spirit of God descending like a dove [and] coming upon him. And a voice came from the heavens, saying, 'This is my beloved Son with whom I am well pleased.'" (v. 16,17) Also, while an eschatological prophet was talking about the coming of the kingdom that Jesus will bring, otherwise known as the Kingdom of God, and what that will be like. Jesus shows us that His kingdom is defined as a relationship to His Father as He is the Son. The Son will do the will of the Father. The beginning of the Galilean ministry and the calling of the first disciples happened after.
In the Gospels of Luke and Mark, they seem to have drawn upon the same source. Although in Luke 4:1-14, there a difference from what is explained in Matthew is that the order of temptations is not the same. The Gospel of Luke shows the order of that the devil took Jesus to the desert, "then he took him up and showed him all the kingdoms of the world in a single instant." (v.4). Concluding, the devil "led him to Jerusalem, made him stand on the parapet of the temple." (v. 9) The Gospel of Matthew follows that Jesus was first tempted in the desert by the devil after fasting for forty days. The next temptation in Matthew is where "the devil took him to the holy city and made him stand on the parapet of the temple" (v. 5). The last temptation of Jesus written in Matthew is where "the devil took him up to a very high mountain, and showed him all the kingdoms of the world in their magnificence." (v. 8) As you can see, the first account of temptations in both Matthew and Luke are similar. Also, in the Gospel of Mark it simply is written that, "At once the Spirit drove him out into the desert and...tempted by Satan." (v. 12,13) Nowhere does it mentioned anything about either of the other two temptations, but has only the similarity of the first temptation in the Gospels of Matthew and Luke. There is no written account of the temptations of Jesus by the devil in the Gospel of John.
This story may convey different messages by however you analyze the reading. One message is that we cannot be like God without God, it is as simple as that. We cannot want everything and expect to be everything without God's grace. Everything good and essential is a gift given to us by God. Though we may not always get what we want, what we want might not always be the best for us. And God knows exactly what is best for us. God shows that what is given at the end for us is a exceptional surprise. Although we have to be mindful of the fact that the devil will tempt us with something we think we need or want. Our