Yes, vanilla is a spice.
Vanilla is derived from orchids of the genus Vanilla, specifically from the fermented and dried seed pods of the flat-leaved vanilla (Vanilla planifolia). These pods are what we commonly refer to as vanilla beans. The beans undergo a curing process, which develops the characteristic flavor and aroma compounds. This process transforms them into a highly sought-after spice used in a variety of culinary applications.
While vanilla extract (which is a solution of vanilla flavor compounds in a solvent, often alcohol) is also widely used, the base ingredient, the vanilla bean itself, firmly classifies vanilla as a spice. It is not an herb because it is not derived from the leafy green part of a plant.