Salvation is a free unmerited gift from Jesus Christ on the Cross. And apart from Christ, no one merits or earns their salvation, no matter what may be their works of prayer, of self-sacrifice, or of assistance to those in need. The Blessed Virgin Mary did not merit her salvation, nor did any of the Saints or martyrs. Thus, the grace of justification, by which we are first placed in the state of grace is prevenient; it is God operating without any cooperation on our part.
If you don’t know the difference between prevenient grace (operating grace) and subsequent grace (cooperating grace), then you will not properly understand Roman Catholic salvation theology. See my post: Prevenient Grace and Subsequent Grace. Or see the longer explanation in my books: The Catechism of Catholic Ethics or Forgiveness and Salvation for Everyone.
The Catholic view of salvation is more complex than the Protestant view. And the teachings of the Magisterium on salvation are much more complex than what passes for salvation theology in Catholic blogs and discussion groups. The oversimplification of our Faith by various online commentators is doing much harm to the Church.
In Catholic teaching, to be saved you must first enter the state of grace by some form of baptism:
1. baptism by water (the formal Sacrament)
2. baptism by desire
3. baptism by blood
If you subsequently fall from the state of sanctifying grace by actual mortal sin, then you must repent and be forgiven by God in order to return to the state of grace. Everyone who dies in a state of grace will have eternal life in Heaven, perhaps after a short or long stay in Purgatory. Everyone who dies in a state of unrepented actual mortal sin will have eternal punishment in Hell. There are no other cases.
But what happens along the way, between entering the state of grace and dying in that state?
Catholic teaching is that we are called to follow Christ. We are morally obligated to avoid mortal sins of commission (murder, adultery, theft, perjury, greed, lust, etc.). But we are also morally obligated to avoid mortal sins of omission. Sins of commission violate negative precepts (“you shall not…”). Sins of omission violate positive precepts (“you shall…”). So you can fall out of the state of grace, and lose your salvation, by what you fail to do, i.e. by a sin of omission.
And what are we obligated to do under these positive precepts? Love and worship God. Love your neighbor. The love of God and neighbor is the path of salvation marked out by Christ. Between entering the state of grace and dying in that state, we are called to show our love for God and neighbor by works of prayer, works of self-denial, and works of mercy to those in need. Without works, your love will slowly die, and you will fall away from Christ and into actual mortal sin. If you call yourself a Christian, but you faith to do any works of prayer, self-denial, or mercy toward others, then you are a liar, not a Christian.
They say “works cannot save”. That statement is only partially true. If you do no good works in your life, you will lose your salvation by an actual mortal sin of omission. So works cannot bring us salvation; salvation is a free gift from Christ. But works of love are an essential part of following the path of salvation.
Exterior works by themselves are only of value if they are accompanied by an interior cooperation with grace. But we are obligated to do both: the exterior works and the interior cooperation with grace. So no one should despise the exterior works of another, nor should we assume that those works were not done in cooperation with grace merely because the person is not Catholic, or not Christian, or not a believer.
Now an adult who is not a Christian can enter the state of grace by a baptism of desire; and this can be accomplished by an act of love, that is to say, by a deed of love of neighbor done in full cooperation with grace. The work is enlivened by the inner love and grace. The work itself does not cause justification; neither the exterior deed, nor the interior cooperation with grace, effects justification. But this act of love readies the soul to accept the prevenient justification of God. And since God stands continually ready to give forgiveness and salvation to everyone, God never fails to grant the state of grace to someone who so prepares to receive it by a full interior cooperation with grace in a deed of love of God or neighbor.
Good works done in cooperation with actual graces, while we are in a state of grace, are in one sense a gift of God. For we would have no graces without the redeeming and sanctifying sacrifice of Christ. But then again, after the fact of Christ’s gift to us, our works deserve a reward from God. By the good works that we perform, through the grace of God and the merit of Jesus Christ, whose living members we are, we truly merit an increase of grace, eternal life, and the attainment of that eternal life, as long as we die in that state of grace.