In order to be righteous before God, the Israelites had to continually follow the law God had given through Moses, keeping all of its commands – something which they proved incapable of doing. But through Jesus Christ’s life and death, God has provided a new way of righteousness, for all people – leading to salvation. As a result of this, the role of the law has been profoundly changed.
The law of Moses could not make anything perfect. Hebrews 7:19a NCV™
For by works of the law no human being will be justified in his [God’s] sight, since through the law comes knowledge of sin. 21But now the righteousness of God has been manifested apart from the law, although the Law and the Prophets bear witness to it— 22the righteousness of God through faith in Jesus Christ for all who believe. Romans 3:20-22a ESV
God’s way now for us to be made righteous before him is through having faith in Jesus Christ. This primarily involves believing Jesus Christ to be (with what he has accomplished) the means of righteousness – and accordingly trusting in him for one’s own righteousness.
In conjunction with this, faith in Jesus Christ encompasses believing what the Bible says about: who he is; his death and resurrection; and the outcomes of his mission. This is discussed further in Getting Right with God.
But they [people] are justified freely by his grace through the redemption that is in Christ Jesus. Romans 3:24 NET
[Paul:] I do not set aside God’s grace, because if righteousness could come through the law, then Christ died for nothing! Galatians 2:21 NET
God’s grace is his free and undeserved favor to people. By God’s grace we are granted righteousness through Jesus Christ’s death for us – as opposed to earning righteousness through obeying the law.
For by grace you are saved through faith, and this is not from yourselves, it is the gift of God; 9it is not from works, so that no one can boast. Ephesians 2:8-9 NET
Here “works” refers to things done in attempting to work for or earn righteousness and salvation – particularly in trying to fulfill the law.
For the law possesses a shadow of the good things to come but not the reality itself, and is therefore completely unable, by the same sacrifices offered continually, year after year, to perfect those who come to worship. … 10By his will we have been made holy through the offering of the body of Jesus Christ once for all. Hebrews 10:1, 10 NET
The Mosaic Law had primarily worked toward the removal of sin and making God’s people holy. But its work really only foreshadowed “the reality” (v. 1) that would be realized through Jesus Christ. For the law’s sacrifices for sin were not sufficient to comprehensively deal with sin and make people perfect (v. 1). But with the sacrifice of himself, Jesus Christ fulfilled what the law with its sin offerings in effect pointed towards, by consummately removing sins (cf. v. 12) and making God’s people holy (v. 10).
Thus the law had become our guardian until Christ, so that we could be declared righteous by faith. 25But now that faith has come, we are no longer under a guardian. Galatians 3:24-25 NET
The law was only ever to be the authority over God’s people until Jesus Christ came, when faith would supersede it as the way for God’s people to be righteous.
Christ, however, offered one sacrifice for sins, an offering that is effective for ever, and then he sat down at the right-hand side of God. … 17And then he [God] says, “I will not remember their sins and evil deeds any longer.” 18So when these have been forgiven, an offering to take away sins is no longer needed. Hebrews 10:12, 17-18 GNT
[Paul, to believers:] For sin will have no mastery over you, because you are not under law but under grace. Romans 6:14 NET
Believers are not under the law but “under grace”. By grace righteousness and salvation are not only gained, as discussed earlier, but are also maintained. For in his grace God enables believers to live godly lives and continues to provide for forgiveness when they do sin. Accordingly, believers are to rely on God’s grace both in striving to please God and for forgiveness.
For no one is declared righteous before him by the works of the law, for through the law comes the knowledge of sin. Romans 3:20 NET
[Jesus:] I tell you the truth, until heaven and earth pass away not the smallest letter or stroke of a letter will pass [away] from the law until everything takes place. 19So anyone who breaks one of the least of these commands and teaches others to do so will be called least in the kingdom of heaven, but whoever obeys them and teaches others to do so will be called great in the kingdom of heaven. Matthew 5:18-19 NET
The spiritual and moral commands of the law basically are the commands pertaining to the believer’s spiritual relationship with God and their relationships with people. Most likely here Jesus had these commands at least primarily in view, with a number of them being the subject of his subsequent teaching (cf. vv. 21-48).