Trying to earn your salvation with works is not biblical, but neither is saying you believe but do not have works.
Salvation and works go hand and hand. Even our Lord Jesus says that if He is your Lord you would do what He says.
If you do not do what He says like repent of your sins, be baptized, confess Him before others, live your life in love toward others including your enemies, and producing good fruit ( works ) then you are not part of His sheep.
Luke 6:46-49
And why call ye me, Lord, Lord, and do not the things which I say? Whosoever cometh to me, and heareth my sayings, and doeth them, I will shew you to whom he is like: He is like a man which built an house, and digged deep, and laid the foundation on a rock: and when the flood arose, the stream beat vehemently upon that house, and could not shake it: for it was founded upon a rock. But he that heareth, and doeth not, is like a man that without a foundation built an house upon the earth; against which the stream did beat vehemently, and immediately it fell; and the ruin of that house was great.
The last part of this scripture that I posted in what our Lord Jesus says shows that if you do not do as He says and follow Him then your ruin will be great.