Our works cannot save us,for our works is as filthy rags,and there is none that does good,no not one,and all are sinners and come short of the glory of God.
So no matter what we do we cannot ever do good enough to receive salvation.
In that position the only thing we can do to correct this position is to have faith,that is why we are saved by faith for that is all we can do,for our works cannot do it.
All we have to do is believe.
Paul said we are not saved by works,but by accepting Christ,which he was addressing Gentiles,and their false religions,that thought they could have favor with God by their religious ways,but Paul said you are not saved by those works but by confessing Christ.
Paul was speaking from a fleshy perspective,not saved by works,and James is speaking from a spiritual perspective,accepting Christ,and being led of the Spirit,justified by works and not faith alone.
If a person does confess Christ,they only have to love people for love is the fulfilling of the law,which is what James is saying,and that is why he said if you do not feed someone when you can,then how do you have faith,and any work they would do apart from that,loving people,like if they go by Old Testament physical ordinances,or do something that another religion would do has no bearing on their salvation,but a waste of time.
Paul,not saved by works,James,but led of the Spirit loving people to have faith active in our life.