We are of God: he that knoweth God heareth us; he that is not of God heareth not us. Hereby know we the spirit of truth, and the spirit of error.
We - true teachers of Christ; in contrast to them.
Are of God - and therefore speak of God; in contrast to 'speak of the world,' 1 John 4:5.
Knoweth God - as his Father, being a child "of God" (1 John 2:13).
Heareth us - (cf. John 18:37.)
Hereby (1 John 4:2-6) - by their confessing, or not confessing, Jesus: by the reception given us respectively by those who know God, and by those who are of the world, and not of God.
Spirit of truth - the Spirit coming from God and teaching truth.
Spirit of error - the spirit coming from Satan, and seducing into error.