This psalm is a psalm of thanksgiving in which the psalmist praises the Lord for deliverance from danger. It is almost a duplication of 2 Samuel 22, which is interesting in that it is the only psalm that is quoted in this way in another book of the Bible. Its location in 2 Samuel suggests that it was written towards the close of David’s life and may be read therefore as his expression of gratitude to God for preserving him throughout his life, including his youth as a shepherd, his long period of exile under Saul, and his years as king over Israel.
The psalm opens with David’s affirmation of love to the God who had been his strength throughout his life. He describes God’s protective activities under several metaphors drawn from David’s military experiences. When he says that the Lord was his rock, he is referring to a large, high rock. This kind of rock gave great protection from enemies because they could not scale its steep walls. It is a good picture of the security each believer has in Christ – they are seated in the heavenly places, far above their enemies. This does not mean that the enemies will not attack us, but it does mean that they will not destroy us.
Verses 4-6 highlight the effectiveness of prayer even in dark situations. David wants his readers and fellow worshippers to appreciate the response of God to the prayers of his people, and verses 7-17 describe it. The Lord was angry with David’s enemies (7-8) and he used the whole of creation to attack them (12-15). But he gently delivered David from his place of danger (16-17) and set him in a place of prosperity (18-19). This cycle was repeated many times in David’s life.
In verses 20-29 David gives a reason for his deliverance, which was his innocence. This does not mean that David was sinless, for we know that there were dark moments of sin in his life. What it does point to is a general principle in the Bible, which is that God usually blesses his people when they try to live in his paths and chastises them when they do not. David’s explanation reminds us of the necessity of sanctification and of progressing in the life of holiness if we want to know God’s approval.
Verses 30 to 45 are almost a repetition of what David has said in verses 4 to 19. There is one difference between the accounts: verses 4 to 19 describe the deliverances from God’s point of view whereas verses 30 to 45 details them from David’s experience. This twofold viewing of events is the best way to survey the incidents in our own lives.
Praise to God is the theme of verses 46 to 50 and it is fitting that believers should close a review of their lives by extolling him. Verse 49 is quoted by Paul in Romans 15:9 as a prediction of Jesus leading the praise of Gentile believers. This quotation points to Psalm 18 being a description of the experiences of Jesus as well as of David.