This is a very important phase in the journey of Jesus. The context is just after the baptism of the Lord in the Jordan by John the Baptist. Jesus was filled with the Spirit and he is now led by the Spirit. Where does the Spirit of God lead him? Into the desert.
I would like to stay on this point for a while. What does the word desert mean in the Scripture? The desert experience of the Chosen people was a very well-know salvation history story for Matthew's community. They knew the story of their liberation from Pharaoh in Egypt and the 40 years of the travels in the desert. Their desert experience was one of being led by God through the Red Sea, being protected from Pharaoh, being fed by the Lord with manna and water from the rock for 40 years. It was a time of learning to depend totally on God, a time of waiting for the promise of the land of milk and honey.
Matthew's community understands that the Spirit of God leads Jesus into a good place. The desert is a safe place. It is a testing place. It is a learning space. Jesus will learn to depend entirely on God. He will be tested. Prayer and the word of God from the Scriptures will strengthen him.
We are living in the desert. 40 years or days is symbolic of the time between our Baptism when we were set free from darkness and our arrival in the Promised Land. Now is the desert time. Now is the time of testing. Now is the time to learn how to depend on God for everything.
The desert is a good experience for the Christian. It is better than it was (darkness). It is not as good as it is going to be (eternal happiness). If we learn to put all our trust in God, we will be like Jesus.