The "deadly pit" and the "miry bog" (v.2) are poetic metaphors for the world of death that the psalmist sees opening up before him; he contrasts this with the "rock", symbolising security and strength. God inspires the psalmist to sing a "new" song (v.3) as distinct from one of lamentation over his suffering; so now he sings a hymn of praise, about his new life after being at death's door (cf. Isaiah 38:10-20). In this hymn, by which many will be drawn to praise God (v.3), he proclaims that man finds his happiness in trust in the Lord and not in pride.

Psalm 40 is typical of those psalms that "with their concrete and varied language, teach us to fix our hope in God: 'I waited patiently for the Lord; he inclined to me and heard my cry' (v.2). As St Paul prayed: ' May the God of hope fill you with all joy and peace in believing, so that by the power of the Holy Spirit you may abound in hope' (Romans 15:13)" (Catechism of the Catholic Church, 2657).

This psalm arrangement is used in the Mass liturgy on the 20th Sunday in Ordinary Time, Year C.