One is saved by Jesus Christ.
This occurs initially by grace (ordinarily) through faith and baptism. Not by good works or works of the law.
Now I must then add the then by the grace of God one needs to remain living * in Christ*…and die as a Christian in Christ…in a state of Grace…there are various aspects to the question …here are some older files of Jimmy Akin…he would prob do better now…they are early…but he keeps them up warts and all for the his older files are still good
cin.org/users/james/files/pastpres.htm cin.org/users/james/questions/q022.htm
It can happen though that some have faith and never get to baptism…(they can be killed for example or not have anyone to baptize them …or not know they need to…though this can thus be a baptism blood or desire)
It can happen that a person has faith infused for the first time in baptism…
It all depends on from what aspect we look at the question. And the particular person. And of course God sees more clearly than we do and sees what we do not.
In the early Church – many converts were older and thus heard the proclamation of the Gospel and had faith (by grace of course)…and then were baptized. As for infants or very small children (note whole households were baptized as we see in Acts) that were baptized into the faith of the Church and for them – faith was infused into them for the first time at baptism…
Today with many children being born into Christian homes …it thus happens the other way around…most receive faith at baptism and increase in it as they live more and more in Christ (or fall away for a while and have to return). Some are baptized at an older age and so likely first have faith first from hearing the Gospel. All is via grave. All is by the Holy Spirit…
A Christian is then to follow Jesus Christ…and know him very personally but this developes…
Jesus can save an infant or a child who as of yet does not even know his name…and Jesus can also save a person who through no fault never hears his name in ways known to Him not to us.
Now if a person who has been justified and made holy --who is “in Christ” by grace via Faith and Baptism --falls into mortal sin --cuts himself off by the sin which is deadly. He will need God to again restore him to “justification”. So he will have left the state of grace – of justification-- and once again by the love and mercy of God --by the blood of Jesus Christ --need to be made right again --so he can be again by the gift and grace of God – “living” in Christ.
And of course he by the grace of God is to “walk in love” and grow in holiness and yes even merit – as the Liturgy of the Church says though --God is crowning his own gifts.
“Happy are you who believe!” (cf 1 Peter 2:7). Let us turn to Jesus! He alone is the way that leads to eternal happiness, the truth who satisfies the deepest longings of every heart, and the life who brings ever new joy and hope, to us and to our world."
~Homily at Yankee Stadium by Pope Benedict XVI