Jesus also closely followed the teachings of Moses. But we see a dramatic difference in the teachings of Jesus and the ritualistic focus of the Pharisees - not only in Jesus' statement here, but among the various exchanges between Jesus and different Pharisees during his teachings.
These describe the Pharisees as focused upon rituals rather than the purpose behind those rituals.
We can see here that Jesus is not opposed to the rituals in themselves.
The ritual of giving a tenth of ones earnings - tithing - depicted here as giving a tenth of herbs grown in the garden (as the Pharisee Jesus is sitting with apparently had an herb garden) - was a practice the Pharisees observed. But Jesus is pointing out that whilst doing that, they were ignoring the core purpose underlying those activities, which is:
"justice and the love of God."
Here "justice" is being translated from the Greek word, κρίσις (krisis), which means, according to the lexicon, "a separating," "selection," "judgement - opinion or decision given concerning anything - especially concerning justice and injustice, right or wrong."
So Jesus is speaking about good judgement. The Pharisees often served judgements upon others and these judgements could well be unjust because of the Pharisees' unbridled focus upon ritualistic Jewish practices.
This context of "justice" - or using good judgement when deciding the fate of others - was also touched upon by Jesus in Luke 11:41 with the word ἐλεημοσύνη (eleēmosynē) - which relates to having mercy or compassion.
Love of God
The important focus of Jesus' statement - and the ultimate source of true justice and mercy - is "love of God."
Jesus states this because "love of God" is the purpose of the various devotional practices and ritualistic ceremonies that have been recommended by God's representatives. Such practices are pleasing to the Supreme Being, assuming they are performed with the purpose originally intended - to help us focus upon the Supreme Being and eventually come to know and love Him.
However, if the purpose of devotional practice or ritualistic ceremonies is to impress others or prove how religious or advanced we are, then those practices will not have the desired effect.
Rather, the ultimate purpose should be "love of God,." as stated by Jesus: "You should have practiced the latter..."
But Jesus isn't saying the ritual was wrong: "...without leaving the former undone."
Jesus is saying the tithing of 10% is not necessarily wrong. But it is wrong to see the tithing - or any other ritualistic practice - as the end in itself - or the goal.
In other words, following the rituals - even if they were established by an ancient prophet such as Moses or even Jesus - is not enough. The focus must be upon the purpose - loving the Supreme Being and pleasing Him.
This was expressed in Moses' greatest instruction - as re-iterated by Jesus:
" 'Love the Lord your God with all your heart and with all your soul and with all your mind.' This is the first and greatest commandment. And the second is like it: 'Love your neighbor as yourself.'" (Matt. 22:37-39)