You must constantly keep in mind the setting for Romans. It is focused exclusively on a controversy between Jewish and Gentile Christians. The Jewish Christians believed that because of their heritage, their Jewishness, they stood right in the sight of God. The Gentile Christians believed they stood right in the sight of God without the trappings of Jewishness.
The problem is that both sides rejected the obedient life.
Chapter two is explicit. Your standing before God is inseparably connected to your obedience to God. God will give to each person according to “what he has done” (verse 6). There will be trouble for everyone “who does evil” (vs. 9), but “glory, honor, and peace for everyone who does good” (vs. 10). Those righteous in God’s sight are those who “obey the law.”
Two points are important just here. First, “obeying” the law doesn’t make you righteous. When you are obedient, you are “declared” righteous. There is a difference. We can’t make ourselves righteous in God’s sight. But we can live in such a way that God will make us righteous.
Second, the Jewish Christians would maintain that they were obedient: after all, they observed all the Jewish festival days, the dietary laws, and circumcision – everything that made them Jewish. They relied on doing these things and because they did them, bragged about their relationship with God. And yet, though they might have maintained all these hallmarks of Judaism, they were miserable failures because their lives were full of sin, ignoring God’s will for them with lives characterized by stealing, adultery, and a total lack of ethics.
The real characteristics of God’s people are not to be found in external rituals, but in a life whose ethics mirror those of God, taught in His word.