...yet we know that a person is not justified by works of the law but through faith in Jesus Christ, so we also have believed in Christ Jesus, in order to be justified by faith in Christ and not by works of the law, because by works of the law no one will be justified. -Galatians 2:16
In his commentary on Galatians John Stott wrote the following in reference to verse 16-
Jesus Christ came into the world to live and to die. In His life His obedience to the law was perfect. In His death he suffered for our disobedience. On earth He lived the only life of sinless obedience to the law which has ever been lived. On the cross He died for our lawbreaking, since the penalty for disobedience to the law was death. All that is required of us to be justified, therefore, is to acknowledge our sin and helplessness, to repent of our years of self-assertion and self-righteousness, and to put our whole trust and confidence in Jesus Christ to save us.