From the CCC:
You are glorified in the assembly of your Holy Ones, for in crowning their merits you are crowning your own gifts.59
2006 The term “merit” refers in general to the recompense owed by a community or a society for the action of one of its members, experienced either as beneficial or harmful, deserving reward or punishment. Merit is relative to the virtue of justice, in conformity with the principle of equality which governs it.
2007 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, for we have received everything from him, our Creator.
2008 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.
2009 Filial adoption, in making us partakers by grace in the divine nature, can bestow true merit on us as a result of God’s gratuitous justice. This is our right by grace, the full right of love, making us “co-heirs” with Christ and worthy of obtaining "the promised inheritance of eternal life."60 The merits of our good works are gifts of the divine goodness.61 "Grace has gone before us; now we are given what is due. . . . Our merits are God’s gifts."62
2010 Since the initiative belongs to God in the order of grace, no one can merit the initial grace of forgiveness and justification, at the beginning of conversion. *Moved by the Holy Spirit and by charity, we can then merit for ourselves and for others the graces needed for our sanctification, for the increase of grace and charity, and for the attainment of eternal life. *Even temporal goods like health and friendship can be merited in accordance with God’s wisdom. These graces and goods are the object of Christian prayer. Prayer attends to the grace we need for meritorious actions.
2011 The charity of Christ is the source in us of all our merits before God. Grace, by uniting us to Christ in active love, ensures the supernatural quality of our acts and consequently their merit before God and before men. The saints have always had a lively awareness that their merits were pure grace.
After earth’s exile, I hope to go and enjoy you in the fatherland, but I do not want to lay up merits for heaven. I want to work for your love alone. . . . In the evening of this life, I shall appear before you with empty hands, for I do not ask you, Lord, to count my works. All our justice is blemished in your eyes. I wish, then, to be clothed in your own justice and to receive from your love the eternal possession of yourself.63**
God determines, according to His wisdom, how man will be saved. Both faith and works, as responses to grace, play their roles, along with other dispositions and virtues, the central one being the virtue of love, which is the epitome of justice for man and the only valid source of his works, BTW.