901 The Lord's answer is given when he says: This is the work of God, that you believe in him whom he sent. Here we should reflect that in Romans (4:2), the Apostle distinguished faith from works, saying that Abraham was justified by his faith, not by his works. If this is so, why does our Lord say here that to have faith, i.e., to believe, is a work of God? There are two answers to this. One is that the Apostle is not distinguishing faith from absolutely all works, but only from external works. External works, being performed by our body, are more noticeable, and so the word "works" ordinaril...y refers to them. But there are other works, interior works, performed within the soul, and these are known only to the wise and those converted in heart.
From another point of view, we can say that to believe can be regarded as included in our external works, not in the sense that it is an external work, but because it is the source of these works.
Thus he significantly says: that you believe in him (in illum). Now it is one thing to say: "I believe in God," (credere Deum), for this indicates the object. It is another thing to say: "I believe God," (credere Deo), for this indicates the one who testifies. And it is still another thing to say: "I believe in God," (in Deum), for this indicates the end. Thus God can be regarded as the object of faith, as the one who testifies, and as the end, but in different ways. For the object of faith can be a creature, as when I believe in the creation of the heavens. Again, a creature can be one who testifies, for I believe Paul (credo Paulo) or any of the saints. But only God can be the end of faith, for our mind is directed to God alone as its end. Now the end, since it has the character of a good, is the object of love. Thus, to believe in God (in Deum) as in an end is proper to faith living through the love of charity. Faith, living in this way, is the principle of all our good works; and in this sense to believe is said to be a work of God.
902 But if faith is a work of God, how do men do the works of God? Isaiah (26:12) gives us the answer when he says: "You have accomplished all our works for us." For the fact that we believe, and any good we do, is from God: "It is God who is working in us, both to will and to accomplish" (Phil 2:13). Thus he explicitly says that to believe is a work of God in order to show us that faith is a gift of God, as Ephesians (2:8) maintains.
Source: Commentary on John