In the Old Testament, God selected the nation of Israel to be His “special” people. As such, they were to be “holy”—separate from the unbelieving nations around them and God’s own possession. This was to be expressed by their obedience to the laws God gave them to direct their life as a nation.
There were civil laws, ritual laws, and moral laws. By the time of Jesus, the Jews thought that the law was a way to earn salvation—something God had never intended. The Bible stresses, “Clearly no one is justified before God by the law, because, ‘The righteous will live by faith'” (Galatians 3:11).
The New Testament says that the Old Testament law was intended “to lead us to Christ that we might be justified by faith” (Galatians 3:24). The ritual laws of sacrifice teach us that “without the shedding of blood there is no forgiveness” (Hebrews 9:22) and point us to Jesus on the cross.
The moral laws—those against lying, stealing, immorality, etc.—show us how far we fall short of God’s will and how badly we need salvation as a free gift, earned by Jesus’ death on the cross (Galatians 3:24).
Once we accept God’s free gift of eternal life through repentance from sin and faith in Jesus, the moral law becomes a guide for how we live out our new life in Christ by the power of the Holy Spirit (Galatians 5:16-26). The civil laws of Israel have passed away, since the church is not a nation.
The ritual laws of sacrifice, priesthood, and temple have been fulfilled in Jesus, and are no longer applicable to the church (see the book of Hebrews). However, the basic moral law of the Old Testament is clearly reflected in the New Testament guidelines for the Christian life (e.g. Colossians, chapter 3) and is summarized by Jesus in Matthew 22:37-40.
Many people feel they can win God’s favor and have eternal life by following the old civil and ritual laws, and do enough good deeds so that they balance out their bad deeds. But this is a misunderstanding. You cannot save yourself—but Christ can, and He will as you commit your life to Him by faith (Ephesians 2:8-9).