How do mercy and the Law work together in the Bible?
Based on my study and understanding of the Bible, the Law and mercy are things that are seen differently depending upon whether it's in the Old or the New Testament.
One source notes:
In the Old Testament God is considered "Merciful and Gracious" and is praised for it, e.g. as in Psalms 103.
In the Old Testament, the Law governed all that God's people did. The Law was given to the people by Moses to help govern them, for (theologically speaking) there was nothing else to guide them. Revenge for "serious injury" was an option given in the Old Testament to the people.
But if there is serious injury, you are to take life for life, eye for eye, tooth for tooth, hand for hand, foot for foot, burn for burn, wound for wound, bruise for bruise. (Exodus 21:23-25)
However, Jesus Christ, in the Sermon on the Mount, when he delivered the Beatitudes (as recorded in the Book of Matthew) stated:
You have heard that it was said, "An eye for an eye, and a tooth for a tooth." But I say to you, do not resist an evil person; but whoever slaps you on your right cheek, turn the other to him also. (5:38-39)
Again in the New Testament, to Christ's followers in Rome, Paul reminds Christians again of the new way:
Do not take revenge, my dear friends, but leave room for God’s wrath, for it is written: “It is mine to avenge; I will repay,” says the Lord. (Romans 12:19, NIV)
For the wages of sin is death, but the gift of God is eternal life in Christ Jesus our Lord. (Romans 6:23)
Do not think that I came to abolish the Law or the Prophets; I did not come to abolish but to fulfill… (Matthew 5:17)
Jesus saw the importance of following the Law; however, with his message of love, he taught the importance of showing mercy and leaving "vengeance" to God.