Paul’s writings are filled with seemingly internal contradictions, and there is nothing more disturbing and distracting that his "contradiction" written in the book of Romans.
Romans 2:13 (NASB) - "for it is not the hearers of the Law who are just before God, but the doers of the Law will be justified."
Romans 3:20 (NASB) - "because by the works of the Law no flesh will be justified in His sight; for through the Law comes the knowledge of sin."
In the midst of criticizing the Jews for their hypocrisy (knowing things yet not doing what was demanded), Paul testifies that it is not those who hear the law who are righteous in God’s sight but those who obey the law (Rom. 2:13). Paul, however, continues in chapter three (Rom. 3:20) in a seemingly contradictory way to inform his audience that no one will be declared as righteous in the sight of God by observing the law. For Paul’s seemingly conflicting messages to be harmonized, we must dive more deeply into the context of Romans 2:13 and 3:20.
It is important to note that Romans 2:13 sets within a somewhat different context than 3:20. In Romans 2:13, Paul is condemning the reality of how knowing God’s will concerning his people was a matter of great pride in Jewish piety. In his "condemnation," Paul reveals the potential areas of hypocrisy on the lines of the Jews' failure to uphold the Law by which they justified themselves. After which, Paul testifies that it is not those who hear the law who are righteous in God’s sight but those who obey the law (Rom. 2:13). Meaning that once one commits to living by the law, his only justification is to keep the entire law; for there is no substitute. In Romans 3:20, Paul is condemning, via the verdict of God, all who are in sin, including those who find themselves under the law. Those who find themselves under the law are just as guilty as those who do not obey the law, given how the nature of the law justifies no one on the bases how the law only shows us how sinful we are. After which, Paul informs his audience that no one will be declared as righteous in the sight of God by observing the law. Meaning that the Jewish Law, by condemning Jewish failures, silences all claims by the Jews to be superior to Gentiles; being the only ones to lay claim to God.
When Paul’s seemingly contradictory messages are reconciled in the above way, we become aware of the reality that there are two possible ways of salvation. The two roads to God include, by grace through faith, or by law through works. In reflection to this truth, Paul’s point is that the road of “works by law” has been permanently blocked by our sin given that when it comes to one’s standing before God, no one has an advantage over another as all are short of God’s manifested glory. The only real road, therefore, to salvation is based on God’s righteousness, since the underlying condition of faith is one that everyone can meet on this earth.