NKJV - 16 Knowing that a man is not justified by the works of the law but by faith in Jesus Christ, even we have believed in Christ Jesus, that we might be justified by faith in Christ and not by the works of the law; for by the works of the law no flesh shall be justified.
For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.
People were saved in the Old Testament in the same way as people in the New Testament - BY FAITH IN GOD. The difference is the "object of the faith". In the Old Testament God said to present the sacrifices as prescribed by the law and God would forgive their sins. They believed God did save them. In the New Testament God said to believe in the finished work of Jesus on the cross for the forgiveness of our sins and the resurrection of Jesus for the gift of eternal life. We believe and God does save us.
The Pharisees, Priests and Teachers of the law were the spiritual leaders of Israel. If anyone had "faith in God" it should be these people. They professed over and over that they were children of Abraham and followers of Moses.
But John the baptist saw through their "fake confessions" when they came to be baptised. The apostle Matthew records:
"But when he saw many of the Pharisees and Sadducees coming to where he was baptizing, he said to them: “You brood of vipers! Who warned you to flee from the coming wrath? Produce fruit in keeping with repentance. And do not think you can say to yourselves, ‘We have Abraham as our father.’ I tell you that out of these stones God can raise up children for Abraham. The ax is already at the root of the trees, and every tree that does not produce good fruit will be cut down and thrown into the fire" (Matthew 3:7-10).
Jesus said the same thing to these spiritual leaders. See Matthew: 12:33-36 & 23:1-36. Their belief was hypocrisy.
Great question, Thelma! Paul and James appear to contradict each other in the matter of justification, i.e. justification by faith vs. Justification by works.
Paul is speaking about justification before God, while James is talking about justification before humans.