Spanish groups nouns into noun classes using a property called "grammatical gender" (género in Spanish). (The word "gender" comes from the Latin word "genus": the original meaning of "gender" in English was "kind, sort, or genus".)
Spanish assigns most nouns to one of two grammatical classes: these classes are conventionally named masculine and feminine. A very small number of nouns have undecided gender: this means that currently there isn't universal agreement among native speakers regarding whether those words are grammatically masculine or feminine.
Most nouns for people and many nouns for animals specify the biological sex of the person or animal, and a different noun is used for a person or animal of the other sex. Many of these pairs of nouns differ only by the change of a suffix or the addition of a suffix (amig-o/amig-a, perr-o/perr-a, dios/dios-a, león/leon-esa, poet-a/poet-isa), but some pairs are completely different (hombre/mujer, caballo/yegua, toro/vaca). In most cases the noun for something that is perceived as biologically male is grammatically masculine and the noun for something that is perceived as biologically female is grammatically feminine.
Some nouns for people and animals have the same form for both genders (el/la artista, el/la dentista, el/la modista, el/la modelo).
Some nouns for people and animals are arbitrarily masculine or feminine regardless of the biological sex of the the person or animal (la persona, la víctima, el testigo, la rana, el sapo, la cabra, la ardilla). In the case of animals, the standard way to indicate the sex is by using one of the invariable adjectives "macho" (male) or "hembra" (female): la rana macho, las ardillas macho, el sapo hembra, los sapos hembra.
Nouns for things that do not have a biological sex (for example, table, water, peace, germs, physics) still have grammatical gender, and the gender is arbitrary.
Spanish also makes limited use of a third gender that is conventionally named neuter: however, no Spanish nouns have neuter gender. Rather, neuter gender is used to refer to concepts and statements for which there is no noun and no assignment of grammatical gender.
The grammatical gender of a noun affects all words that modify that noun: all articles and some adjectives have different masculine and feminine forms, and all articles and adjectives that modify a noun must have the same grammatical gender as the noun that they modify.