The following is from Gaudete et Exsultate, Chapter Two, sections 47-56 (found on the Vatican website--footnotes and section number headings removed):
Gnosticism gave way to another heresy, likewise present in our day. . . . The same power that the gnostics attributed to the intellect, others now began to attribute to the human will, to personal effort. This was the case with the pelagians and semi-pelagians. Now it was not intelligence that took the place of mystery and grace, but our human will. It was forgotten that everything “depends not on human will or exertion, but on God who shows mercy” (Rom 9:16) and that “he first loved us” (cf. 1 Jn 4:19). . . .
The Church has repeatedly taught that we are justified not by our own works or efforts, but by the grace of the Lord, who always takes the initiative. The Fathers of the Church, even before Saint Augustine, clearly expressed this fundamental belief. Saint John Chrysostom said that God pours into us the very source of all his gifts even before we enter into battle. Saint Basil the Great remarked that the faithful glory in God alone, for “they realize that they lack true justice and are justified only through faith in Christ”.
The Second Synod of Orange taught with firm authority that nothing human can demand, merit or buy the gift of divine grace, and that all cooperation with it is a prior gift of that same grace: “Even the desire to be cleansed comes about in us through the outpouring and working of the Holy Spirit”. Subsequently, the Council of Trent, while emphasizing the importance of our cooperation for spiritual growth, reaffirmed that dogmatic teaching: “We are said to be justified gratuitously because nothing that precedes justification, neither faith nor works, merits the grace of justification; for ‘if it is by grace, it is no longer on the basis of works; otherwise, grace would no longer be grace’ (Rom 11:6)”.
The Catechism of the Catholic Church also reminds us that the gift of grace “surpasses the power of human intellect and will” and that “with regard to God, there is no strict right to any merit on the part of man. Between God and us there is an immeasurable inequality”. His friendship infinitely transcends us; we cannot buy it with our works, it can only be a gift born of his loving initiative. This invites us to live in joyful gratitude for this completely unmerited gift, since “after one has grace, the grace already possessed cannot come under merit”. The saints avoided putting trust in their own works: “In the evening of this life, I shall appear before you empty-handed, for I do not ask you, Lord, to count my works. All our justices have stains in your sight”.
This is one of the great convictions that the Church has come firmly to hold. It is so clearly expressed in the word of God that there can be no question of it. Like the supreme commandment of love, this truth should affect the way we live, for it flows from the heart of the Gospel and demands that we not only accept it intellectually but also make it a source of contagious joy.