According to Matthew 4:1-2 (and parallel accounts in Mark 1:12-13 and Luke 4:1-2), after His baptism by John in the River Jordan, Jesus was led by the Holy Spirit into the wilderness, where He fasted for 40 days and 40 nights. At the end of this period, He was hungry, and the devil came to tempt Him.
The number 40 carries significant symbolic weight in the Bible. Moses spent 40 days and 40 nights on Mount Sinai receiving the Law (Exodus 34:28). Elijah travelled 40 days and 40 nights to Mount Horeb (1 Kings 19:8). The Israelites wandered in the wilderness for 40 years. Jesus' 40-day fast echoes these Old Testament precedents and establishes a parallel between His experience and that of Israel.
During the temptation, the devil presented three specific challenges: turning stones to bread, throwing Himself from the temple pinnacle, and accepting dominion over all kingdoms in exchange for worship. Jesus resisted each temptation by quoting Scripture from Deuteronomy. The duration of 40 days is consistently stated in all three Synoptic Gospel accounts.