So how does this work?
A Question of identity as a son/daughter
As a believer we now have a heavenly Father. We are sons (or daughters), so as sons we always try to do what our father wants. So when the son is tempted to do something outside this, he looks through the lens of a son and doesn’t do it.
A Question of practice
Every day I practice being a good son because it is my identity. Jesus did exactly the same thing. For example, when Jesus was only 12 years old, he demonstrated this perfectly. When his family went to Jerusalem, they lost him and only found him after 3 days at the Temple. When his parents asked what he was doing there he replied,
“Didn’t you know that I had to be in my Father’s house?”
He lived to please first his Father not his parents. He lived to be the perfect son every day.
A Question of the help of the Holy Spirit
We have the Holy Spirit in us and His identity is the Spirit of adoption and sonship (Rom 8:15) and so by him we cry “Abba father”. The Spirit testifies that we are sons and helps us to relate as sons.
Note that the inverse is also true. The Spirit rested on Jesus at his baptism because he was the perfect Son. The more we work at being sons the more the Spirit rests on us naturally. And so we can ask the Holy Spirit to help us in our weakness, when we are tempted, to be obedient as sons.
Conclusion
We must walk in our identity as a son (or daughter) and believing that as a son and with the help of the Holy Spirit we can truly live as sons who are like our Father in heaven.