In this extended section David reviewed how God had saved him in times of danger. In verses 4-19 he described God's supernatural deliverance and in verses 20-29 he explained it as he saw it through the lens of his faith in God.
18:4-5 Death had had him in its grip as rope binds a prisoner. The forces of ungodliness terrified David as when one finds himself in a wadi (dry stream bed) during a spring thunderstorm and discovers a wall of water coming at him. He pictured himself trying to pick his steps through a field full of traps that hunters had set to snare animals.
18:6-15 David cried out in terror, and in His heavenly temple God heard his call for help. He came rushing to the psalmist's defense. His deliverance was as a thunderstorm in that it was the supernatural invading nature. The figures of speech in verses 7-15 picture a violent storm with lightning, thunder, high winds, torrential rains, black skies, and flooding. All of this illustrates God's dramatic intervention for David punishing those who opposed His anointed.
"The most vivid descriptions of God as warrior occur in so-called theophanic passages, which depict the Lord coming in splendor and power to fight for His people. . . .
"Psalm 18:7-16 is the most detailed of these theophanic texts."53
18:16-19 God delivered the writer as a life guard rescues a drowning man from the water that threatens to overwhelm him. David's host of enemies almost swallowed him up, but God removed him from their clutches and brought him to a place of safety out of their reach.
18:20-24 As God had promised to bless those of His people who walked in obedience to His will (Deut. 28), so he blessed David who followed the Lord faithfully. By recounting his own righteousness David was not implying that he merited God's favor by his good works. He was showing God's faithfulness to His covenant promises to Israel. These verses would have encouraged the Israelites to follow David's example of righteous behavior so they too would experience God's favor (cf. 2 Tim. 4:6-8).
". . . David could quite properly use this language within a limited frame of reference, [but] the Messiah could use it absolutely; and the psalm is ultimately Messianic . . ."54
18:25-29 God responds in kind as people act toward Him (cf. Gal. 6:7). He rewards them because of their characters and deeds. He is always just. Those who try to twist God to make Him serve their ends will find that He will bend them to fulfill His will (cf. Jacob and Balaam).55He saves the humble and humbles those who think they can save themselves. He kept the lamp of David's life burning by delivering his life from the hands of his enemies. Moreover He enabled His servant to advance against his foes and to overcome their defenses.