In Spanish, every word has one "stressed" syllable (the acento prosódico), but we only write the accent mark (the tilde) when the word breaks certain patterns. Always work relative to the END of words. It does not matter if the words has two syllables (entro) or ten (electroencefalografista).
1. Agudas (Stress on the LAST syllable)
These carry a tilde only if the word ends in a vowel, N, or S.
With Tilde: canción, café, estás, Perú.
Without Tilde: amor, papel, feliz, cantar.
2. Graves / Llanas (Stress on the PENULTIMATE syllable)
These are the opposite of Agudas. They carry a tilde only if the word ends in a consonant that is NOT N or S.
With Tilde: árbol, lápiz, túnel, cáncer.
Without Tilde: imagen, mesa, examen, zapato.
3. Esdrújulas (Stress on the ANTEPENULTIMATE syllable)
The easiest rule: these ALWAYS carry a tilde.
Examples: sábado, rápido, gótico, pájaro.
4. Sobresdrújulas (Stress before the antepenultimate)
Common with compound verbs and pronouns. These ALWAYS carry a tilde.
Examples: cuéntamelo, dígaselo, préstamelo.
Special Cases (The "Boss" Levels)
Hiatus (Hiato): When a "weak" vowel (i, u) is stressed next to a "strong" vowel (a, e, o), we use a tilde to break the sound, even if it ignores the SEGA rules.
Example: baúl, río, sonreír.
Diacritical Accents: Used to distinguish two words that are spelled the same but have different meanings.
Example: mí (me) vs. mi (my) | él (he) vs. el (the) | té (tea) vs. te (you) | sí (yes) vs. si (if).