Why was Daniel's life spared?
King Nebuchadnezzar was given a dream by God, which he did not understand. The dream greatly disturbed him and he summoned his wise men to interpret it. Yet instead of telling them the dream and letting them explain what it meant he demanded that they tell him what he dreamed and also give the interpretation. They could not do that because no one can read a person's mind. They knew that no one could read minds and that only "gods" could do that. They begged him to tell them the dream but he refused and decreed that they and the wise men in his empire would be executed.
Nebuchadnezzar was the eldest son of Nabapolassar who had conquered Ninevah and founded the great Babylonian empire referred to throughout the Bible. Most of the wise men had served his father and he did not trust them. He was certain they would tell him what they thought he wanted to hear. When they could not tell him what he wanted he had dreamed he issued a decree to have all of the wise men executed.
When Daniel heard that all of the wise men in the kingdom were to be executed, including his three companions and himself, he quickly took action. He went directly to Arioch, the captain of the king's guard and sought an audience with Nebuchadnezzar. He was permitted to make his request to the king for a short period of time to seek the interpretation. He was granted the time and immediately found Hannaniah, Mishael and Azariah. They prayed to God and the dream with the interpretation was given to Daniel in a vision.
Daniel praised the Lord with his companions for answering their prayer. In his prayer of praise he stated some important truths concerning God. He blessed the name of God and said that wisdom and might belong to Him. He also said that God changes the times and seasons, that He removes kings from power. This was an acknowledgment that God has supreme control over His creation and that He can do whatever He wishes with nature.
He said that God gives wisdom to the wise and knowledge to those who have understanding and reveals the deep and secret things to men. Daniel also declared that God know what is in the darkness and light dwells with Him. Daniel concluded by praising the God of his fathers for giving him "wisdom and might,' and the answer to their request.
Immediately after Daniel was given the dream and the interpretation he rushed to see Arioch to tell him he knew the interpretation of the king's dream. Arioch rushed him to see Nebuchadnezzer who asked him if he could interpret it. Daniel explained that no one, not wise men, enchanters, magicians nor soothsayers could give the interpretation; only the God in heaven knows what the dream is and what it means. He added that God made known to him what will be in the latter days, which is what we are living in now.
Daniel described the dream to the king and interpreted it, concluding his exhortation by saying that the "great God" made known to Nebuchadnezzer what would come to pass after him. He added that the dream was "certain" (it would come to pass) and his interpretation would prove to be correct.
Nebuchadnezzar was overwhelmed by what Daniel said, when he interpreted the dream and had his servants make an offering to him. We don't know what that was but part of it was sweet odors of some kind. He then praised the God of Daniel declaring that Daniel's God is the God of gods, and the Lord of kings (Daniel 2:47). He added that this supreme God was a revealer of secrets.
After making an initial gift to Daniel and praising the God of gods, Nebuchadnezzar showered Daniel with numerous gifts and promoted him to the second highest-ranking position in his empire. He became the king's top advisor and administrator. Daniel took advantage of this promotion and in turn promoted his companions to positions of authority just under him. Daniel was also made the "chief governor over all the wise men of Babylon" making him the top political figure (behind the king) and the top religious leader. Not only was his life spared because God gave Daniel a special vision and ability to interpret the king's dream, he was tremendously rewarded.