40:1-3 The psalmist testified to his people that the Lord had answered his prayer for deliverance after a long wait. God had reestablished His servant. Consequently David had a new song of praise for the Lord. His praise would encourage others to renew their confidence in Yahweh.
40:4 The person who does not rely on the self-sufficient or liars but puts his complete trust in the Lord experiences great blessing.
40:5 The Lord's wonderful acts for the righteous are too numerous to recount fully much less His beneficent thoughts. No one can compare with Yahweh regarding His gracious plans to bless.
40:6 Animal and meal offerings were not of primary importance to God under the Mosaic Law. More important than sacrifices for either worship or expiation was the believer's true commitment of himself or herself to the Lord.
The phrase, "my ears Thou hast opened,"or "pierced"may mean David viewed God as having made him His willing slave by being so gracious to him (cf. Exod. 21:6). However it seems more probable that David meant God had given him the ability to comprehend and obey His Word (cf. v. 8).
40:7-8 Because God had been so good to David, the psalmist yielded his life as a living sacrifice (Rom. 12:1-2). As the Lord's anointed king, David was responsible to follow the directions handed on to him in the scroll of the Mosaic Law. Because God had captured his affections, David could say the Law was in his heart, not just in his hands. He delighted to do God's will rather than just doing it out of obligation.
In Hebrews 10:5-7 the writer of that epistle quoted verses 6-8 concerning Jesus Christ's attitude at His incarnation. The sacrifices of the Mosaic system could never satisfy God's high demands. They only covered sin temporarily and expressed worship superficially. The offering that satisfied God was the willing self-sacrifice of the sinless Son of Man. Jesus Christ offered Himself to God as David did, as he expressed in this psalm.
40:9-10 Part of God's will for David, as a person and as Israel's king, was praise to the Lord. The psalmist said he carried out this duty joyfully. He spoke publicly of God's righteousness, faithfulness, salvation, loyal love, and truth.