Psalm 31 was sent by David to “the music director” to be put to music and used in worship. Although it gives no clues with regard to the timing of the events mentioned, its proximity to Psalm 30 may indicate that this was the full content of the prayer for his life that David mentioned there.
In Psalm 31:1-8 David praised God for his character and past faithfulness in helping David. Without getting into the details yet, David asked for deliverance yet again, but quickly turned to praise. He called God his “high ridge” and “stronghold.” He trusted that God would not “deliver [him] over to the power of the enemy.” On an even more personal note, David knew that God did “notice [his] pain” and was “aware of how distressed” David was. How much more we can be sure that God knows our pain, since we have his very own Spirit indwelling us.
Psalm 31:9-13 provides more detail of what David was facing at this time in his life. He was physically beaten down, thinking he would die soon. His sin weighed him down, though a specific sin is not mentioned. He felt that his contemporaries wanted nothing to do with him, because of his situation. Plots were being made against him. It was as if his entire life was falling apart, and he knew it.
Praising God again, David made his requests in Psalm 31:14-20. He asked for rescue from his enemies. He asked that they would be humiliated instead of him, and that their slander would be silenced and proven false.
The psalm ends with David’s call to others to praise God as well (Psalm 31:21-24). Using himself as the example, David proved that God had been faithful in the past and was certain to be faithful in the future as well. Because of this, “the LORD deserves praise,” and all of his followers – including believers today – should “be strong and confident” as we “wait on the LORD.”