Moses states in verse 25 of Deuteronomy 6, “And if we are careful to obey all this law before the LORD our God, as he has commanded us, that will be our righteousness.” A casual reading of this verse might lead you to believe that all the Israelites had to do was follow the rules laid out in the Law and God would consider them to be righteous before Him. Is this interpretation correct?
No. It is always dangerous to read any Bible verse out of context. At the beginning of chapter 6, Moses makes clear that the Israelites are to “Love the LORD your God with all your heart and with all your soul and with all your strength.” (Jesus later affirms this as the greatest command.) Moses also repeats the command to “fear God” three times in chapter 6 alone.
Loving and fearing God cannot only consist of following the commands in the Law. Loving and fearing God at least consist of 1) trusting God, 2) believing what God says about Himself, and 3) having faith in His promises. We already know from Gen 15:6 that Abraham believed God, and God counted his belief as righteousness. There was no Law when Abraham was alive.
Therefore, a person who ritualistically follows the Law without loving God, without fearing God, without believing God, is not in any way pleasing God. So how should we interpret Deut 6:25? Eugene Merrill, in Deuteronomy: An Exegetical and Theological Exposition of Holy Scripture (The New American Commentary), offers this summary:
Then in strongly evangelical terms Moses equated faithful compliance with the covenant to righteousness (v. 25). The word used here is ṣĕdāqâ, the very one applied to Abraham as a result of his having believed in the Lord (Gen 15:6). Later Judaism wrongly concluded that covenant keeping was the basis for righteousness rather than an expression of faithful devotion. But true covenant keeping in the final analysis is a matter of faith, not merely of works and ritual. Thus the central feature of the covenant stipulations is their providing a vehicle by which genuine saving faith might be displayed (cf. Deut 24:13; Hab 2:4; Rom 1:17; 4:1–5; Gal 3:6–7).
God provided the Law as a means for the Israelites to enact their love for and faith in God. Without love and faith, keeping the Law counted for nothing.