Actually,he said this:
"For we hold that a man is justified by faith apart from works of law" (Ro.3:28).
"Works of law" and not the "works of THE law."
By using the word "law" without the definite article he is referring to both "the law" which was given to the Jews as well as the work of the law written in their hearts of the Gentiles of which the conscience bears witness (Ro.2:15).
So when the word "law" is used it is speaking of the moral law.
Look at the context, he's talking about the same law.
14 For when Gentiles who do not have the Law do instinctively the things of the Law, these, not having the Law, are a law to themselves, 15 in that they show the work of the Law written in their hearts,
What version do you read works of law?