As the title indicates, David wrote this psalm after he had subdued his political enemies and had established the kingdom of Israel firmly under his control. In it David expressed his delight in the Lord and thanked Him for giving him the victories he enjoyed. This psalm is also in 2 Samuel 22. The slight variations may be due to changes that Israel's leaders made when they adapted this poem for use in Israel's public worship.
David began his praise by verbalizing his love for God for being so good to him. He proceeded to describe how much the Lord meant to him by using many metaphors. Yahweh was the source of his strength, stability, safety, and salvation. He was the one in whom David sought refuge, his defense, his power, and his protection. Because God had proved to be such a reliable Savior, the psalmist regarded Him worthy of his praise.
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.
The psalmist rejoiced over God's character and His blessings to him (vv. 30-45), and he vowed to continue to praise Him forever (vv. 46-50). The purpose of the psalm is praise, not boasting.
18:30-31 God's way is perfect, and His Word is trustworthy. He is the only true God, a reliable defense and a solid foundation for His people (cf. Deut. 32:4, 31).
18:32-42 We should probably read verse 32 with verse 33 rather than with verse 31. David gave the Lord credit for enabling him to be a strong and effective warrior. God was responsible for David's successes in battle.
18:43-45 God had even extended David's victories beyond the borders of Israel. The king had been able to subdue other kingdoms and bring them under his control. David's greatest Son will be able to echo these sentiments when He rules on earth during the Millennium.
18:46-50 Only a living God could do all this for David. Consequently the king promised to praise Him among those who did not know Yahweh. God's deliverance and His loyal love are the final gifts David mentioned as those he treasured above all others. He was confident because of what God had done for him that Yahweh would prove faithful and deliver David's descendents as He had promised as well (2 Sam. 7).
God's people should always acknowledge the magnificent multifaceted character of our God. We should also recount His awesome acts of deliverance for us. Furthermore we should continue to rely on His future faithfulness in view of who He is and what He has done for us.