The purpose of salvation is to do good works, but no one is saved by doing good works.
As Ephesians 2:8-10 says, "For it is by grace you have been saved through faith – and this not from yourselves, it is the gift of God – not by works, so that no one can boast. For we are Gods workmanship, created in Christ Jesus to do good works, which God prepared in advanced for us to do." But, our works do however perfect our faith, for James 2:22, after talking about people who claimed to have faith with their works, now talks about Abraham, "You see that his faith and his actions were working together, and his faith was made complete by what he did." It is only by working of the Holy Spirit who sanctifies the regenerate believer, however, that one can fully become more like Christ. And those who are saved will live according to the Spirit, for Galatians 5:16 says, "So I say, live by the Spirit and you will not gratify the desires of the sinful nature." Therefore by doing works in the Spirit, one is able to produce good fruit – for in verse 5:22-23 "But the fruit of the Spirit is love, joy, peace, patience, kindness, goodness faithfulness, gentleness and self-control. Against such things there is no law." In some bit of a sense, no one who is not saved can counterfeit the fruit of the Spirit. As it is said in Philippians 3:3 after Paul speaks of those who mutilate the flesh (the equivolent of Circumcision without the Spirit) and who take boast in such things, Paul says that it is the Christian who boast in Christ and Worship by the Spirit.