Yahweh the Deliverer
Psalm 18 is a "Thanksgiving Psalm” and, in contrast to Psalm 17 (asking God for present deliverance), is thanking God for past deliverance. It is basically the same Psalm as in 2 Samuel 22, with David possibly having made revisions so it could be of use in public worship. The Psalm was written mid-career, at a time when David enjoyed Yahweh's aid in many victories, especially his deliverance from Saul (2 Samuel 7:1).
The Psalm was written in a chiastic structure:
1) Praise Him for His deliverance and refuge (1-3)
2) Praise Him for His great power from Heaven (4-19)
3) Praise Him for His righteous reward (20-24)
4) Praise Him for His matching responses (25-27)
3) Praise Him for His grace reward (28-30)
2) Praise Him for His great power in me (31-48)
1) Praise Him for His salvation and steadfast love (49-50)
Notice the contrasts of stanzas “2." In verses 4-19, the emphasis is on what God did for David; in verses 31-48, the emphasis is on what God did through David. Notice the contrasts in stanzas “3." In verses 20-24, the emphasis is on David's righteousness and what he did right, but in verses 28-30 it is God who lit up his life in darkness and made him strong. Notice in stanza “4," David recognizes the law of sowing and reaping in our relationship with God (25-27).
Purpose: Revealing how to pray after we have encountered a great blessing or victory, giving voice to what God has done for us and what God has done through us to keep our hearts humble and dependent on Him in times of great success.