An aromatic compound is a cyclic compound that contains #4n+2# electrons in a planar conjugated #pi# system (#n = 0, 1, 2, …#), meaning the electrons are delocalized throughout the molecule, promoting resonance stabilization.
The most common aromatic compounds contain benzene rings (#n = 1#).
But any planar cyclic compound that contains 2, 6, or 10 #pi# electrons is aromatic.
Examples are azulene, with 10 #pi# electrons, and pyridine, thiophene, and imidazole, each with 6 #pi# electrons---but only those electrons that are in the ring count as being delocalized.
In thiophene, one pair of sulfur's lone electrons resides in a #p# orbital coplanar with the ring, protruding outwards, and is thus localized (if you consider those delocalized #pi# electrons in the ring to be in #p_z# orbitals, then the coplanar electrons are in a #p# orbital that lies on the #xy#-plane).
Similarly, pyridine's #sp^2#-nitrogen's lone pair and imidazole's #sp^3#-nitrogen's lone pair of electrons are also coplanar with the rest of the ring, on a #p# orbital protruding outwards.
You can see this from pyridine's MO depiction, for example: