If we count the total number of π electrons, there are 10. But to apply Hückel's rule to this molecule, we should count only the electrons of the outer periphery and there are 8 of these. How can the molecule be aromatic?
Consider this structure of purine:
The ring on the left contains two nitrogen heteroatoms and is aromatic due to π electron conjugation. Having six π electrons, it obeys Hückel's rule.
For the ring on the right, it contains four π electrons in bonds and the lone pair on the NH group takes part in conjugation. Hence the total number of electrons taking part in conjugation is six, which makes it aromatic by Hückel's rule as well.
Since both the rings of purine are aromatic, the compound is aromatic.
For more information see: Ciesielski, A.; Krygowski, T. M.; Cyrański, M. K.; Balaban, A. T. Defining rules of aromaticity: a unified approach to the hückel, clar and randić concepts. Phys. Chem. Chem. Phys. 2011, 13 (9), 3737–3747. DOI: 10.1039/C0CP01446J.