Lest there be any doubt of the correctness of the answer, in Luke's description of what was probably the same event, Jesus explicitly affirmed that answer:
Luke 10:25 Behold, a certain lawyer stood up and tested him, saying, “Teacher, what shall I do to inherit eternal life?”
26 He said to him, “What is written in the law? How do you read it?”
27 He answered, “You shall love the Lord your God with all your heart, with all your soul, with all your strength, and with all your mind; [Deuteronomy 6:5] and your neighbor as yourself. [Leviticus 19:18]” 28 He said to him, “You have answered correctly. Do this, and you will live.”
So how do we love God?
One way, Jesus said, is to follow His teachings, or commandments. See John 14:15-24. I take it that much of those teachings are in the Sermon on the Mount, Matthew 5-7.
I did an on-line search, and found these articles (there are many others):
This one says that being thankful is the key. (That includes being thankful for things we don't like.) This one gives several pointers, and discusses what to do when we don't feel like loving God. Here is an essay on loving God with all your mind. Here is a page that gives six good ideas on how to love God. The six are: 1) obeying the commandments 2) trusting 3) put God first 4) be committed 5) be humble 6) spend time in prayer.
George Croly expressed love for God in a great poem.
Let me add a couple of ideas. If I really love someone, I will pay attention to what they say, even if I don't like it, or it's repetitive. If I really love someone, I want to be in their company. If I really love someone, I want the best for them -- I want them to be thought well of.
Thanks for reading.