Which came first?
If you obey my commands, you are really my disciples. Then you will know the truth, and the truth will set you free. – John 8:31
This brings to mind Bonhoeffer's statement that 'we cannot believe with obeying; we cannot obey without believing.' There is a chicken and egg element to this. Fortunately, the chicken, the egg, and our faith all come from God.
Christian life runs on the fuel of faith, but faith is inextricably bound up with works. And, perhaps counterintuitively, if our faith is suffering, obeying may help.
Understanding this also helps address the tension between James and Paul, in which Paul claims we're justified by faith, and James says we're justified by works.
Faith must precede works, but works must follow and will produce additional knowledge of the truth and greater faith.