When the NT speaks of “The Law” with a capital “L” or as a definite object (as opposed to “a law” or just “law”) it is not usually speaking generically of the concept of commandment or a requirement imposed on one party by another. The Lutheran tradition (and some in the Reformed tradition) tend to categorize nearly everything in the Bible as either law or gospel, giving the impression that a command or legal obligation is contra-gospel and therefore bad, and passages which teach the good news of grace are gospel and therefore good. According to this view, nearly every text can be categorized as either Law of Gospel. Although there is some truth to this law-gospel perspective on the OT-NT Scriptures (for example, in the Reformation doctrine of justification by faith alone), it is certainly not what the NT means by the specific category of “The Law”. Rather, the NT (and the OT prophets) makes a distinction between the old covenant and the new covenant—the old covenant being the relationship set up between the LORD and the physical descendants of Israel at Sinai (and mediated by Moses), and the new covenant being the relationship set up between the LORD and the faithful descendants of Israel (and mediated by the Lord Jesus Christ), established at the cross (Jn 1:17).
The Law (i.e., the old covenant) is useful in basically three ways according to the NT authors and Jesus. First, the Law is meant to hold accountable the whole world as guilty before God. The penalty for sin is punishment and death, and there is no child of Adam that is righteous before God according to the Law of God (Gal 2:16). So the Law is meant to establish guilt and impute sin to those who know the Law (written in stone or on the human heart), which is everyone (Jn 7:19; Acts 7:53; Rom 2:12-16; 5:20)! This guilty status before the Law is meant to drive sinners to despair of their own “righteousness” and drive them instead to the mercy and grace of God found in the gospel of Jesus Christ (Acts 13:38-39; Rom 7:12-14). Second, for those sinners who trust in the righteousness of God and find mercy in Christ, the Law then takes on an additional use. The Law that once drove them to despair now becomes a delight—not in the sense of a way of salvation, but as a righteous standard of holy living coram deo (before the face of God). The Christian should love the Law of God, because it is a revelation of God’s will for how he desires his people to live (Rom 7:21-25). But for guilty sinners who refuse the refuge provided in Christ from the wrath of God, the Law serves a third use—to restrain evildoers with the threat of punishment (both at the hands of man and of God) and to stop their mouths from protesting their punishment (Rom 3:19-20).
Matthew focuses on how Jesus came to fulfill the Law, not to destroy it (Mt 5:17-18; 12:1-8). Luke equates the Law of Moses (the old covenant), the Law of the Lord, and the Law (Lk 22-32). Luke also highlights the Law as fulfilled in Jesus (Lk 24:44-47). Paul teaches that there is a righteousness that comes from obeying the Law which is merited, and a righteousness that comes by faith which is graciously given through the gospel (Rom 4:13-17). Paul does not call the Law evil or sin, only the misuse of it (Gal 3:19-29). According to Paul, the new covenant message is that we cannot go back to the Law without submitting to its bondage. He even compares the Law of Moses with slavery and the Promise to Abraham with freedom (Gal 4:21-31). The writer of Hebrews describes at great length how the Law was superseded, fulfilled, and in a sense made obsolete in the ministry of Christ (Heb 7-10). James contrasts the Law of Moses with the “law of liberty” by noting that one under the Law who is guilty of breaking a law is guilty of all, but we should speak and act according to the “law of liberty” (Jam 2:12).