The people and their king address the Lord and thank Him for what He did for them in answer to their prayers. Compare 21: with 21:5, 21: with 20:4, and 21: with 20:1. The word salvation in verses 1 and 5 (kjv) means “deliverance, victory.” David had prayed that his life be spared (v. 4), and the Lord answered him (v. 2; 20:1, 6). This blessing was part of God’s covenant with David (2 Sam. 7:16). The word prevent in verse 3 (kjv) means “to see to it beforehand” (69:10; 79:8). The Lord met Joshua before the battle of Jericho (Josh. 5:13–15), and Melchizedek (a type of Jesus Christ) met Abraham after the battle with the kings (Gen. 14); and God went before David and “welcomed” him (niv) to the battlefield and the victory. That God goes before His obedient people is a great encouragement (48:14; 77:20; John 10:4; Deut. 8:2).
Some students connect the gold crown of verse 3 with Israel’s victory over the Ammonites at Rabbah (2 Sam. 12:26–31), but this victory actually belonged to Joab. David didn’t join the siege until the very end. The crown is probably symbolic of God’s special “blessings of goodness” upon David (v. 5; and see 8:5). To David, the victory God gave was like a second coronation, assuring him that he was indeed God’s anointed. Length of days forever (v. 4) and blessings forever (v. 6) remind us of God’s covenant with David that was ultimately fulfilled in Christ (2 Sam. 7:6, 13, 16, 29; Luke 1:30–33; and see Ps. 10:16; 45:17; 48:14; 133:3). It was customary to attribute endless life to kings (Neh. 2:3; Dan. 2:4). While he reigned, David would not be “shaken” by his enemies, because his faith was in the Lord (v. 7; 10:6; 16:8; 55:22; 121:3). This declaration of faith is the central verse of the psalm.