The psalm opens with two beatitudes: blessed is the one whose transgression is forgiven and whose sin is covered, and blessed is the one whom the Lord does not charge with guilt and in whose spirit there is no deceit. With three different words, transgression, sin and iniquity, David shows that forgiveness reaches every kind of wrong.
Then he tells his own experience. While he kept silent, his bones wasted away and he groaned all day long, because God's hand was heavy on him and his strength dried up as in summer heat. Then he resolved to acknowledge his sin, did not cover his iniquity and confessed his transgression to the Lord, and God forgave the guilt of his sin.
For that reason every faithful person should pray at a time when God may be found, and when great floods come they will not reach him. The Lord is his hiding place and surrounds him with songs of deliverance. Then God speaks: he promises to instruct and teach the way and warns against being like the horse or mule that must be held in with bit and bridle. Many are the sorrows of the wicked, but steadfast love surrounds the one who trusts the Lord, and the psalm closes with a call to be glad and sing.