The Catholic Church has never taught such a doctrine and, in fact, has constantly condemned the notion that men can earn or merit salvation. Catholic soteriology (salvation theology) is rooted in apostolic Tradition and Scripture and says that it is only by God’s grace—completely unmerited by works—that one is saved.
The Church teaches that it’s God’s grace from beginning to end which justifies, sanctifies, and saves us. As Paul explains in Philippians 2:13, “God is the one, who, for his good purpose, works in you both to desire and to work.”
Notice that Paul’s words presuppose that the faithful Christian is not just desiring to be righteous, but is actively working toward it. This is the second half of the justification equation, and Protestants either miss or ignore it.
James 2:17 reminds us that “faith of itself, if it does not have work, is dead.” In verse 24 James says, “See how a person is justified by works and not by faith alone.” And later: “For just as a body without a spirit is dead, so also faith without works is dead” (2:26).
The Council of Trent harmonizes the necessity of grace and works: “If anyone says that man can be justified before God by his own works, whether done by his own natural powers or by the teaching of the Law, without divine grace through Jesus Christ, let him be anathema” (Session 6; can. 1).
The Council fathers continued by saying, “If anyone says that the sinner is justified by faith alone, meaning that nothing else is required to cooperate in order to obtain the grace of justification and that it is not in any way necessary that he be prepared and disposed by the action of his own will, let him be anathema” (Session 6: can. 9).
By the way, “let him be anathema” means “let him be excommunicated,” not “let him be cursed to hell.” The phrase was used in conciliar documents in a technical, theological sense, not in the same sense as the word “anathema” is found in Scripture. Don’t let “Bible Christians” throw you for a loop on this one.
So, far from teaching a doctrine of “works righteousness” (that would be Pelagianism, which was condemned at the Council of Carthage in A.D. 418), the Catholic Church teaches the true, biblical doctrine of justification.