You have to see the context of that statement to see what Paul is stating. He is stating that only the doers of the law are justified, not the hearers.
Rom 2:5 But in accordance with your hardness and your impenitent heart you are treasuring up for yourself wrath in the day of wrath and revelation of the righteous judgment of God,
Rom 2:6 who "WILL RENDER TO EACH ONE ACCORDING TO HIS DEEDS":
Rom 2:7 eternal life to those who by patient continuance in doing good seek for glory, honor, and immortality;
Rom 2:8 but to those who are self-seeking and do not obey the truth, but obey unrighteousness—indignation and wrath,
Rom 2:9 tribulation and anguish, on every soul of man who does evil, of the Jew first and also of the Greek;
Rom 2:10 but glory, honor, and peace to everyone who works what is good, to the Jew first and also to the Greek.
Rom 2:11 For there is no partiality with God.
God's Judgment and the Law
Rom 2:12 For as many as have sinned without law will also perish without law, and as many as have sinned in the law will be judged by the law
He goes on to say:
Rom 2:13 (for not the hearers of the law are just in the sight of God, but the doers of the law will be justified;
Rom 2:14 for when Gentiles, who do not have the law, by nature do the things in the law, these, although not having the law, are a law to themselves,
Rom 2:15 who show the work of the law written in their hearts, their conscience also bearing witness, and between themselves their thoughts accusing or else excusing them)
Rom 2:16 in the day when God will judge the secrets of men by Jesus Christ, according to my gospel.
He is saying all people, will be judged by their deeds.