You do not understand the nature of justifying faith or you would not ask such a question.
Justifying faith or faith that embraces Jesus Christ and His provision for justificaiton is a work of God (Jn. 6:29) as no man cometh to the son except the father "draw him" (Jn. 6:44) as faith must be "given unto him of the Father" (Jn. 6:65) and every single one the father "teaches" will come to the Son (Jn. 6:45) and every single one that comes to the Son will be raised to resurrection of eternal life (Jn. 6:39,40,44) and so justifcation is "by faith" so as to be "of grace" (Rom. 4:16) whereas "works" are not of grace (Rom. 4:4).
We are justified by works but not OUR works but the works of Jesus Christ which are received through faith as the basis of imputed righteousness.
Rom. 3:27
Where is boasting then? It is excluded. By what law? of works? Nay: but by the law of faith.
28 Therefore we conclude that a man is justified by faith without the deeds of the law.
Paul had just stated that we are "
justified freely by his grace" (v. 24). Now in verse 27 he challenges his readers to find any grounds for boasting. In this challenge "
Where is boasting then" he immediately denies there is any grounds for boasting in justification "
freely by his grace" by saying "
IT IS EXCLUDED."
At this point he then considers only two contrasting alternatives and why one is based upon a principle (law) that would exclude all boasting while the other is based upon a principle (law) that would include boasting.
By what law? of works? Nay.
Justification based upon the "law" or "principle" of works promotes boasting because "works" by its very nature earns favor and makes the one you are working for indebted to you and this is precisely what Paul says a few verses later when he discusses the very same issue of boasting in regard to Abraham:
2 For if Abraham were justified by works, he hath whereof to glory; but not before God.....4 Now to him that worketh is the reward not reckoned of grace, but of debt.
The same Greek word translated "glory" in Romans 4:2 is the very same word translated "boasting" in our text in Romans 3:27.
This is what Paul means by "the law" of works. The term "law" is used here to describe the underlying PRINCIPLE by which something operates. Justification based upon the PRINCIPLE "of works" promotes boasting because "works" by its very NATURE places the one you are working for in your "debt" and therefore it is not of grace:
Now to him that worketh is the reward not reckoned of grace, but of debt.
That is the "law" or Principle that defines the nature "works".
Hence, the term "law" here has nothing to do with the Mosaic Law or the Law written upon the heart of Gentiles or any human law. Instead it is used here by Paul in the same sense we use the term "law" when we talk about the "law of gravity" or the principle by which gravity operates and thus what it is by nature.
Paul then denies that justification by the law "of works" excudes boasting:
By what law? of works? Nay.
By its very nature or according to the principle that characterizes it, Justification cannot be by works because "works" always incurs "debt" and therefore is not of grace:
Now to him that worketh is the reward not reckoned of grace, but of debt.
Hence, Paul has excluded all doctrines of justification based upon the principle or "law" of works. That would exclude justification by the Law of Moses because that is based upon the principle of works. That would exclude the Law written in the conscience of Gentiles because that is based upon the very same principle or law of works.
The only "law" or principle that can Justify sinners which excludes all boasting is justification by the law or principle of faith because "faith" excludes all grounds for boasting because it excludes all "works":
"5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness.
6 Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
Note that "worketh not" is contrasted "but" with "beleiveth on him" and that is "without works."
Hence, the only basis for justification that excludes boasting is justification by faith without works:
Rom. 3:27 Where is boasting then? It is excluded. By what law? of works? Nay: but by the law of faith.
28 Therefore we conclude that a man is justified by faith without the deeds of the law.
This is the only basis that provides LEVEL ground for both Jews and Gentiles alike before God because it excludes all works done by both in response to either the Law of Moses or the Law written on their conscience and equally provides justification based upon FAITH ALONE "without works":
29 Is he the God of the Jews only? is he not also of the Gentiles? Yes, of the Gentiles also:
30 Seeing it is one God, which shall justify the circumcision by faith, and uncircumcision through faith.
Moreover, this is the only way the Law of God whether it is revealed in the Mosaic Law or it is revealed in the conscience to Gentiles can be established by the believer and not be violated or made void. Because justification is by faith alone in another who acted as their substitute in keeping the law and satisfied it completely and fully in their behalf and that is what they embrace by faith in the gospel the finished work of Jesus Christ that satisfies all the laws requirement and imputes his righteousness, the righteousness of God, the righteousness revealed in the Mosaic law and the righteousness revealed in conscience, that righteousness is imputed to them by faith:
31 Do we then make void the law through faith? God forbid: yea, we establish the law.
In contrast, all others "have sinned and come short of the glory of God" therefore, "no flesh" can be justified by the law of works, "ALL the world" stands condemned by the law of works and "every mouth" is stopped from boasting that they have fulfilled the law by works. Hence, BY FAITH ALONE in the finished work and Person of Christ is the only "law" or "principle" that does not make "void the Law" but establishes the Law in behalf of the beleiver.