The grace of the Holy Spirit can confer true merit on us, by virtue of our adoptive filiation, and in accordance with God's gratuitous justice. Charity is the principal source of merit in us before God.
Source: Catechism of the Catholic Church (Vatican.va)