The Catholic Church teaches that “Justification has been merited for us by the Passion of Christ who offered himself on the cross as a living victim, holy and pleasing to God, and whose blood has become the instrument of atonement for the sins of all men” (Catechism of the Catholic Church no. 1992). A person is saved only by the blood of Christ and by nothing he did, or ever could do. Salvation is a free gift of God (CCC 614). No one can earn heaven.
The Catholic Church has never taught justification by works alone (The Council of Trent, Session six, Decree on Justification, ch. 8), nor does the Bible teach justification by faith alone (Romans 2:13; James 2:24, etc). Rather, “In Christ Jesus, neither circumcision nor uncircumcision counts for anything, but only faith working through love” (Galatians 5:6). Works have their role in our salvation, but our initial justification does not come from them. The Council of Trent Canon 1 says, “If anyone says that man can be justified before God by his own works, whether done by his own natural powers or through the teaching of the law, without divine grace through Jesus Christ, let him be anathema”.
Concerning sanctification, *The Catechism of the Catholic Church * states: “The merit of man before God in the Christian life arises from the fact that God has freely chosen to associate man with the work of his grace. The fatherly action of God is first on his own initiative, and then follows man’s free acting through his collaboration, so that the merit of good works is to be attributed in the first place to the grace of God, then to the faithful. Man’s merit, moreover, itself is due to God, for his good actions proceed in Christ, from the predispositions and assistance given by the Holy Spirit” (*Catechism of the Catholic Church * no. 2008).
It’s faith working through love that enables a person to perform loving actions that please God (Romans 8:8-9, Colossians 1:10, 1 Corinthians 7:32). The fact that God is pleased moves him to reward these actions on the Last Day (Romans 2:6-10, Galatians 6:6-10). Yet the action does not earn the reward God gives. He is simply pleased and wishes to reward the person who pleased him.
For further reading on this subject, I suggest the following articles
Justification by Faith Alone
Righteousness and Merit