The sermon on the mount demonstrates that keeping the law is utterly inadequate. The Pharisees did that. We need to obey the inner witness in our spirit man, the living word that the Holy Spirit imparts to us. That is not automatic. It is easy to override that witness. You can't have a relationship with a book or stone. God wants us to be His friends, as Abraham was. Very few have that kind of fellowship with God. I can assure you of this. No one gets that kind of relationship with God by outward obedience to a set of rules. We need to know God as a Person, not as a remote and unapproachable Cosmic cop looking for reasons to punish people.A combination of faith (belief/trust) and works (obedience to Gods law) in tandem grants righteousness/justification (God's approval). Because we will still fall short and do not deserve this approval, we still require grace (a free gift/pardon) for eternal life.
God is love. He knows all about us and loves us anyway. If we love Jesus, yes, we will obey Him. But that is not just following a set of rules. It's moment by moment, day by day.
Simple example. I wanted another guitar. I looked through the second hand ads online. I saw one that was ideal. The seller lived 5 minutes away. The problem was that the cost was way more than my budget. I told a friend about it. Immediately she said that she would pay the difference. She heard from the Lord Jesus. I bought the guitar and it's been a blessing. You won't find chapter and verse to justify what she did. She was led by the Spirit of God and so demonstrated that she is a child of God. And that is the secret to the Christian life. She had no "legal" obligation to me. She could have told me to lower my sights and buy something within my budget. She knows nothing about guitars. She does know the Lord Jesus.