The Bible teaches that we are justified, counted guiltless of both of our inborn sin and the sins we commit because of that inborn condition, by God's charity (His grace) through our faith in Jesus Christ alone. So what do our good works--things like active love of God and active love of neighbor--have to do with our justification?
Nothing and everything.
They have nothing to do with our justification because, first of all, no good work we might do can warrant God's "not guilty" verdict over our sinful lives. Even the good we do in this life will be tinged by sinful self-interest. Good works containing any sin couldn't possibly save us.
They also have nothing to do with our justification because, until we physically die to this world and are raised eternally, our inborn sin nature will continue, despite our true repentance, to impel us, against our wills, to sin.
But good works that live out love of God and love of neighbor, works that we would not even consider doing apart from the Holy Spirit, sent by Christ to those who believe, living in us, also have everything to do with God graciously justifying those who believe in Jesus Christ.
Good works done by the believer in Christ are sure evidence of a person who hs been justified before God through their faith in Christ. "If anyone is in Christ, the new creation has come: The old has gone, the new is here!" (2 Corinthians 5:17)
Christians are made new through the justifying grace of God covering them with the righteousness of Jesus through the means of grace: The Word and the Sacraments, through which the Holy Spirit creates and sustains saving faith within us.
The one who has faith in Jesus Christ is set free to do truly good works, that is, good works that live out love of God and love of neighbor. The justified person will, without second-thought (Matthew 25:31-46), be impelled by the Holy Spirit to do those things that sinful humanity, left to our own devices, would never do.Paul writes: "The fruit of the Spirit is love, joy, peace, forbearance, kindness, goodness, faithfulness, gentleness and self-control. Against such things there is no law. Those who belong to Christ Jesus have crucified the flesh with its passions and desires." (Galatians 5:22-24) Our good works cannot justify us. But all who believe in Christ are saved and through that justifying faith, the Holy Spirit does good works through us.
This is why Paul goes on to say in Galatians 5:24: "Since we live by the Spirit, let us keep in step with the Spirit." In other words, whatever good the Holy Spirit is calling us to do, however contrary to our inborn desires or impulses, let us heed that call.
The connection between faith and good works and the fact that faith precedes good works, that faith justifies and not our works is underscored in Ephesians 2:8-10: "For it is by grace you have been saved, through faith—and this is not from yourselves, it is the gift of God— not by works, so that no one can boast. For we are God’s handiwork, created in Christ Jesus to do good works, which God prepared in advance for us to do."
John puts it even more succinctly: "We love because he first loved us." (1 John 4:19)
Our good works, love in action, cannot justify us. Only Christ does that. To say otherwise, pours contempt on Christ and His cross. But our good works, love of God and love of neighbor acted out in even the smallest of ways, demonstrates that we are justified, declared and actually made innocent of our sin by God's grace given to all who have faith in Jesus Christ.