We - true teachers of Christ: in contrast to them.
are of God - and therefore speak of God: in contrast to “speak they of the world,” 1Jo 4:5.
knoweth God - as his Father, being a child “of God” (1Jo 2:13, 1Jo 2:14).
heareth us - Compare Joh 18:37, “Every one that is of the truth, heareth My voice.”
Hereby - (1Jo 4:2-6); by their confessing, or not confessing, Jesus; by the kind of reception given them respectively by those who know God, and by those who are of the world and not of God.
spirit of truth - the Spirit which comes from God and teaches truth.
spirit of error - the spirit which comes from Satan and seduces into error.