Many teach salvation by works. Matthew 7:22-23 clearly shows that Jesus revealed they boasted in their many wonderful works they did in the His name. Yet Jesus did not praise them nor did He exalt them; He rebuke them. Many today are modern day Pharisees. They try to make people live under the Law. If you go read in the Bible account, Jesus rebuked those Pharsees. He did not praise them nor did he exalt them.
Answer:Partial quotes, avoiding the section that contradicts your argument does you no good.
"Not everyone who says to Me, 'Lord, Lord,' shall enter the kingdom of heaven, but he who does the will of My Father in heaven. Many will say to Me in that day, 'Lord, Lord, have we not prophesied in Your name, cast out demons in Your name, and done many wonders in Your name?' And then I will declare to them, 'I never knew you; depart from Me, you who practice lawlessness!" (Matthew 7:21-23).
"But why do you call Me 'Lord, Lord,' and do not do the things which I say? Whoever comes to Me, and hears My sayings and does them, I will show you whom he is like: He is like a man building a house, who dug deep and laid the foundation on the rock. And when the flood arose, the stream beat vehemently against that house, and could not shake it, for it was founded on the rock. But he who heard and did nothing is like a man who built a house on the earth without a foundation, against which the stream beat vehemently; and immediately it fell. And the ruin of that house was great" (Luke 6:46-49).