I think it pertinent to quote more from Matthew 5 because it in essence answer the question. I have added emphasis where it comes applicable to the answer.
The Fulfillment of the Law
17“Do not think that I have come to abolish the Law or the Prophets; I have not come to abolish them but to fulfill them. 18I tell you the truth, until heaven and earth disappear, not the smallest letter, not the least stroke of a pen, will by any means disappear from the Law until everything is accomplished. 19*Anyone who breaks one of the least of these commandments and teaches others to do the same will be called least in the kingdom of heaven, but whoever practices and teaches these commands will be called great in the kingdom of heaven.* 20For I tell you that unless your righteousness surpasses that of the Pharisees and the teachers of the law, you will certainly not enter the kingdom of heaven.
Murder
21“You have heard that it was said to the people long ago, ‘Do not murder,a and anyone who murders will be subject to judgment.’ 22But I tell you that anyone who is angry with his brotherb will be subject to judgment. Again, anyone who says to his brother, ‘Raca,c’ is answerable to the Sanhedrin. But anyone who says, ‘You fool!’ will be in danger of the fire of hell.
23“Therefore, if you are offering your gift at the altar and there remember that your brother has something against you, 24leave your gift there in front of the altar. First go and be reconciled to your brother; then come and offer your gift.
25“Settle matters quickly with your adversary who is taking you to court. Do it while you are still with him on the way, or he may hand you over to the judge, and the judge may hand you over to the officer, and you may be thrown into prison. 26I tell you the truth, you will not get out until you have paid the last penny.d
Adultery
27“You have heard that it was said, ‘Do not commit adultery.’e 28But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart. 29If your right eye causes you to sin, gouge it out and throw it away. It is better for you to lose one part of your body than for your whole body to be thrown into hell. 30And if your right hand causes you to sin, cut it off and throw it away. It is better for you to lose one part of your body than for your whole body to go into hell.
Divorce
31“It has been said, ‘Anyone who divorces his wife must give her a certificate of divorce.’f 32But I tell you that anyone who divorces his wife, except for marital unfaithfulness, causes her to become an adulteress, and anyone who marries the divorced woman commits adultery.
Oaths
33“Again, you have heard that it was said to the people long ago, ‘Do not break your oath, but keep the oaths you have made to the Lord.’ 34But I tell you, Do not swear at all: either by heaven, for it is God’s throne; 35or by the earth, for it is his footstool; or by Jerusalem, for it is the city of the Great King. 36And do not swear by your head, for you cannot make even one hair white or black. 37Simply let your ‘Yes’ be ‘Yes,’ and your ‘No,’ ‘No’; anything beyond this comes from the evil one.
An Eye for an Eye
38“You have heard that it was said, ‘Eye for eye, and tooth for tooth.’g 39But I tell you, Do not resist an evil person. If someone strikes you on the right cheek, turn to him the other also. 40And if someone wants to sue you and take your tunic, let him have your cloak as well. 41If someone forces you to go one mile, go with him two miles. 42Give to the one who asks you, and do not turn away from the one who wants to borrow from you.
Love for Enemies
43“You have heard that it was said, ‘Love your neighborh and hate your enemy.’ 44*But I tell you: Love your enemies and pray for those who persecute you*, 45that you may be sons of your Father in heaven. He causes his sun to rise on the evil and the good, and sends rain on the righteous and the unrighteous. 46If you love those who love you, what reward will you get? Are not even the tax collectors doing that? 47And if you greet only your brothers, what are you doing more than others? Do not even pagans do that? 48Be perfect, therefore, as your heavenly Father is perfect.
It becomes clear in these passages that Jesus Law did not override the Old Testament, but in fact where just like clarifications or additions. Amendments if you will
Christ did not simply do away with the law, he ended or fulfilled it. Jesus is the substance of the shadows, the anti type of the types, and the very epitome of all the moral enunciation of the law. Jesus said, "Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfill" (Matt. 5: 17). Notice the next verse, "For verily I say unto you, Till heaven and earth pass, one jot or one tittle shall in no wise pass from the law, till all be fulfilled" (vs. 18). Jesus fulfilled the law and inaugurated his system or testament (Lk. 24: 44, 47). Christ's system is not without law, but the onerous system of Moses was nailed to Jesus' cross (Gal. 6: 2, Col. 2: 14, see addendum). Jesus' apostles are "able ministers of the new testament" (2 Cor. 3: 6). The Law of Moses could not impart life (2 Cor. 3: 7-18). The law was only a "schoolmaster to bring us (Jew, dm) unto Christ, that we might be justified by faith" (Gal. 3: 24). "But after that faith is come," Paul continued, "we are no longer under a schoolmaster" (vs. 25). Paul warned regarding any who would attempt justification by the Law of Moses. Hear him: "Christ is become of no effect unto you, whosoever of you are justified by the law; ye are fallen from grace" (Gal. 5: 4). One cannot be saved by a system of meritorious works that seek to earn salvation and by grace at the same time (Rom. 11: 6). John said, "For the law was given by Moses, but grace and truth came by Jesus Christ" (Jn. 1: 17)