The Catechism in Questions & Answers

277. What is the relationship between the law and the gospel?

Both the law and the gospel reveal God’s will to help sinners come to salvation. The law primarily lists commandments and prohibitions that instruct human beings with regard to God-pleasing actions. The only human being who perfectly fulfilled this law without any violations is Jesus Christ: “Do not think that I came to destroy the Law or the Prophets. I did not come to destroy but to fulfil” (Matthew 5: 17).
The elements of the Mosaic Law that are always valid and necessary were summarised by Jesus Christ into the commandment to love God and one’s neighbour: “You shall love the Lord your God with all your heart, with all your soul, and with all your mind. [...] You shall love your neighbour as yourself ” (Matthew 22: 37, 39).
After His resurrection, He explained to the disciples that everything written in the Law of Moses, in the Prophets, and in the Psalms, had found its fulfilment in Him (cf. Luke 24: 44).
From this follows that Christ is both the fulfilment and the goal of the law. The old covenant’s understanding that the law was the way to salvation has come to an end through Christ. Jesus has established a new way, the way of grace.

“For Christ is the end of the law for righteousness to everyone who believes.”
Romans 10: 4