Ephesians 2:8 For by grace you have been saved through faith. And this is not your own doing; it is the gift of God, 9 not a result of works, so that no one may boast.
How ever a man saying he has faith does not mean he has any faith.
That is why James said,
James 2
18
Yea, a man may say, Thou hast faith, and I have works: shew me thy faith without thy works, and I will shew thee my faith by my works.
No contradiction there, just an explanation that words do not prove anything.