Paul was sent to the Gentiles,and had to deal with their false religions as he preached the truth to try to turn them to Jesus,as well as any Old Testament saints to try to turn them from the physical ordinances of the law,those works,unto Jesus and the works of the Spirit which is works of love,which Paul called charity.
Paul was telling them that all the works they do in their false religions,or of the works of the Old Testament,the physical ordinances,will not find them favor with God,but only by confessing Christ can they find favor with God.
When Paul was addressing them that their works will not save them,they have not confessed Christ yet,and have not received the Spirit yet.
When they confessed Christ they did not receive the Spirit yet,so faith alone,and not saved by works,is the only thing they could do.
When they received the Spirit then the situation changed from being fleshy to being spiritual so then they had to have works of the Spirit,charity,works of love,to have faith active in their life,for love is the fulfilling of the law.
Paul said charity is greater than faith,and faith means nothing without charity,works of love,which can only be done perfectly by the Spirit.
Faith works by love,and it is love alone,not faith alone.
If a person lacks works of love,then they lack faith,for love is the fulfilling of the law.
After Paul addressed them that their works will not find them favor with God but only by confessing Christ,then he addresses them in the spiritual sense having the Spirit,and must have works of love to have faith active in their life,and says the same thing as James.
Paul says the same thing as James,and people should understand when Paul is speaking according to them being fleshy when they confess Christ that it is faith alone,and not saved by works,and when he is speaking to them being spiritual having works of love by the Spirit.
When we first come to Christ it is faith alone,and not saved by works,for that is all we can do,but some people want to drag that throughout their walk with God,but after we receive the Spirit then it is faith without works is dead,and a person is justified by works,and not faith alone,for we have to have works of love,for faith to be active in our life,and they are not works of the flesh,but of the Spirit.
And there is no lacking concerning that and think you are alright with God,for the Bible says love is the fulfilling of the law,and only goes by their needs,and helps people with their needs,and even feeds and clothes their enemies,and prays for them,and blesses them,and is not unkind.
We see many people that say faith alone,and not saved by works,that lack in love and their lifestyle testifies of it.
Jas 2:14 What doth it profit, my brethren, though a man say he hath faith, and have not works? can faith save him?
Jas 2:15 If a brother or sister be naked, and destitute of daily food,
Jas 2:16 And one of you say unto them, Depart in peace, be ye warmed and filled; notwithstanding ye give them not those things which are needful to the body; what doth it profit?
Jas 2:17 Even so faith, if it hath not works, is dead, being alone.
James points out charity,works of love,in a person's life,which if they lack and being selfish,and not caring about the needs of others,or to show any kind of love towards them then their faith is dead.
To call people names,and not love your enemies caring for their needs,and being unkind,and not caring that they are fed and clothed,and help them where ever they have a need,and doing it intentionally then faith is dead,for God's kingdom is love,and to lack that love would put in the position of the kingdom of the world,which they lack in love,for only by the Spirit can you love perfectly.
Jas 2:21 Was not Abraham our father justified by works, when he had offered Isaac his son upon the altar?
Jas 2:22 Seest thou how faith wrought with his works, and by works was faith made perfect?
Jas 2:23 And the scripture was fulfilled which saith, Abraham believed God, and it was imputed unto him for righteousness: and he was called the Friend of God.
Jas 2:24 Ye see then how that by works a man is justified, and not by faith only.
Jas 2:25 Likewise also was not Rahab the harlot justified by works, when she had received the messengers, and had sent them out another way?
Jas 2:26 For as the body without the spirit is dead, so faith without works is dead also.
James points out works of love towards God to obey Him,and works of love towards people as Rahab helping out the two men.
James points out have charity,works of love by the Spirit or your faith is dead.,and James is speaking when a person receives the Spirit.
1Co 13:2 And though I have the gift of prophecy, and understand all mysteries, and all knowledge; and though I have all faith, so that I could remove mountains, and have not charity, I am nothing.
1Ti 6:5 Perverse disputings of men of corrupt minds, and destitute of the truth, supposing that gain is godliness(money,material things,their wants): from such withdraw thyself.
1Ti 6:8 And having food and raiment let us be therewith content.
1Ti 6:10 For the love of money is the root of all evil: which while some coveted after, they have erred from the faith, and pierced themselves through with many sorrows.
Paul is saying the same thing as James when a person receives the Spirit to have charity,works of love,and if people believe that God blesses with money,and material things for their wants,and preaches that withdraw yourselves from them,having food and clothing be content,for the love of money is the root of all evil because it neglects the poor and the needy,and God's kingdom is love,and out of all that we did on earth only love will go on forever,and Paul said if they lack then they have erred from the faith like James said their faith is dead.
Paul said we do not void out the law through faith,but we establish the law,and the law is spiritual,and holy,and just,and good,the moral laws,laws of love.
And love is more than only feeding the poor and needy,and caring about whatever need they have,but Paul said love does not think an evil thought,does not sin by the Spirit,and is not arrogant,not selfish,and not unkind,and we are to love our neighbors as ourselves,so however we want to prosper we should want that for our neighbors,and God said He wants equality among the saints,but how many people care that other saints benefit like them,and it is almost like every person for themself.
Any laws that are moral,and of love,are spiritual laws,always have to be obeyed,which means abstain from sin,for the Lord knows them that are His having this seal,let everyone that names the name of Christ depart from iniquity,and Paul said awake to righteousness,and sin not,but some do not have the knowledge of God,and he speaks that to their shame.
It is the same as the Old Testament to them that did not abide they were cut off,which Paul said do not be highminded but fear,for if God spared not them in the Old Testament that did not abide in the truth take heed lest He also not spare you,for if you do not continue in His goodness you will also be cut off,and do not depart from the living God by the deceitfulness of sins.
Rev 2:4 Nevertheless I have somewhat against thee, because thou hast left thy first love.
Rev 2:5 Remember therefore from whence thou art fallen, and repent, and do the first works; or else I will come unto thee quickly, and will remove thy candlestick out of his place, except thou repent.
Rev 3:2 Be watchful, and strengthen the things which remain, that are ready to die: for I have not found thy works perfect before God.
Rev 3:3 Remember therefore how thou hast received and heard, and hold fast, and repent. If therefore thou shalt not watch, I will come on thee as a thief, and thou shalt not know what hour I will come upon thee.
And that is why there is warnings in the Bible because some do lack those works which Jesus tells them to repent,and if they could not ever fall from salvation,and their works have nothing to do with their salvation,and if they lack they are still right with God,then why the warnings in the Bible concerning it.
If you look at America and all the people that claim Christ you will see that the majority lack in love,which the Bible says they say they are rich,and increased in goods,and have need of nothing,and the last generation many people will be pure in their own eyes but not washed away from their filthiness.
Paul says the same thing as James to have works,charity,or you are nothing,and have erred from the faith.
People should understand when Paul is addressing the issue that all of our works apart from Christ cannot find us favor with God,for we were saved by faith alone,and our works did not matter for we were fleshy when we came to Christ,and when he is speaking according to being spiritual for Paul says the same thing as James.
When you receive the Spirit the situation changes to where your works do matter,because your love matters,and love is the fulfilling of the law,and to lack those works is to lack love,and love is greater than faith.