Protestants are just plain wrong when they say that Catholics believe in salvation by works. This canard is nothing more than pseudo-knowledge grounded on (at best) misunderstanding. In VS §§10-11 we see JPII affirm the Catholic view once again.
The moral life presents itself as the response due to the many gratuitous initiatives taken by God out of love for man. It is a response of love, according to the statement made in Deuteronomy about the fundamental commandment: “Hear, O Israel: The Lord our God is one Lord; and you shall love the Lord your God with all your heart, and with all your soul, and with all your might. And these words which I command you this day shall be upon your heart; and you shall teach them diligently to your children” (Dt 6:4-7). Thus the moral life, caught up in the gratuitousness of God’s love, is called to reflect his glory: “For the one who loves God it is enough to be pleasing to the One whom he loves: for no greater reward should be sought than that love itself; charity in fact is of God in such a way that God himself is charity”.18
11. The statement that “There is only one who is good” thus brings us back to the “first tablet” of the commandments, which calls us to acknowledge God as the one Lord of all and to worship him alone for his infinite holiness (cf. Ex 20:2-11). The good is belonging to God, obeying him, walking humbly with him in doing justice and in loving kindness (cf.Mic 6:8). Acknowledging the Lord as God is the very core, the heart of the Law, from which the particular precepts flow and towards which they are ordered. In the morality of the commandments the fact that the people of Israel belongs to the Lord is made evident, because God alone is the One who is good. Such is the witness of Sacred Scripture, imbued in every one of its pages with a lively perception of God’s absolute holiness: “Holy, holy, holy is the Lord of hosts” (Is 6:3).
But if God alone is the Good, no human effort, not even the most rigorous observance of the commandments, succeeds in “fulfilling” the Law, that is, acknowledging the Lord as God and rendering him the worship due to him alone (cf. Mt 4:10). This “fulfilment” can come only from a gift of God: the offer of a share in the divine Goodness revealed and communicated in Jesus, the one whom the rich young man addresses with the words “Good Teacher” (Mk 10:17; Lk 18:18). What the young man now perhaps only dimly perceives will in the end be fully revealed by Jesus himself in the invitation: “Come, follow me” (Mt 19:21). [Italics in original; boldface added]
God does not tell Israel that they must save themselves. As the pope points out, He tells them in Dt 6—in the Shema— that they are already His people, and that their response must be to love Him, and that this love must take the form of obeying Him. Of course, this is nothing less than what Christ commands us: “If you love Me, keep My commandments” (John 14:15).
But it is nothing new to say this. St Thomas makes it clear that we cannot save ourselves because it is beyond our power to do so—both because of our sins and because we are finite.
Acts conducing to an end must be proportioned to the end. But no act exceeds the proportion of its active principle; and hence we see in natural things, that nothing can by its operation bring about an effect which exceeds its active force, but only such as is proportionate to its power. Now everlasting life is an end exceeding the proportion of human nature, as is clear from what we have said above (Question 5, Article 5). Hence man, by his natural endowments, cannot produce meritorious works proportionate to everlasting life; and for this a higher force is needed, viz. the force of grace. And thus without grace man cannot merit everlasting life; yet he can perform works conducing to a good which is natural to man, as “to toil in the fields, to drink, to eat, or to have friends” [ST I-II q109 a5].
The nature of grace is repugnant to reward of works, according to Romans 4:4: “Now to him that worketh, the reward is not reckoned according to grace but according to debt.” Now a man merits what is reckoned to him according to debt, as the reward of his works. Hence a man may not merit the first grace.
I answer that, The gift of grace may be considered in two ways: first in the nature of a gratuitous gift, and thus it is manifest that all merit is repugnant to grace, since as the Apostle says (Romans 11:6), “if by grace, it is not now by works.” Secondly, it may be considered as regards the nature of the thing given, and thus, also, it cannot come under the merit of him who has not grace, both because it exceeds the proportion of nature, and because previous to grace a man in the state of sin has an obstacle to his meriting grace, viz. sin. But when anyone has grace, the grace already possessed cannot come under merit, since reward is the term of the work, but grace is the principle of all our good works, as stated above. [ST I-II q114 a5]
So when we seek to obey God, it is not so that we might save ourselves. We can’t. Rather, we obey Him because we love Him, and because He tells us that the evidence of that love is our obedience. Consequently Christian morality is grounded in love for God, not in some misplaced, mercenary idea that we do good in order to be saved (which is impossible anyway).