Philippians 2:12, 13 reads: “Therefore my beloved, as you have always obeyed… work out your salvation with fear and trembling, for it is God who works in you, both to will and work for his good pleasure.”
Do these verses teach that salvation is by works? Not at all! Salvation means more than just regeneration (being born-again) because salvation includes being declared righteous before God on the basis of Christ’s righteousness (justification) and being conformed to the character of Christ (sanctification).
These verses are referring to sanctification. In sanctification God plays his role and we pray our role too. God gives us the grace to will and work for his good pleasure but it takes us to obey and act.
Consider an example of a drunkard who gets converted. God will give him the grace and power of not going back to getting drunk but it will literary take this person not to touch the bottle and put it on his mouth. It’s absurd to think that because this person is saved whenever he is tempted to get drunk, an invisible hand of God will always push his hand away from the bottle.
This is what it means to work out our salvation. God gives us the grace and power to reject sin but it takes us to take action to avoid or overcome sin in our lives.