In Spanish the stress in words depends on how the word ends. If the word ends in an -s or an -n or a vowel, then the word stress is on the last but one syllable, otherwise on the last syllable. Syllables with an accent always have the stress. Read more for a more comprehensive explanation...
Which syllable has the stress?
Does the word end in an -s or an -n or a vowel? Then the word stress is on the last syllable but one:
bancodentistalibrosseñora
If the word only exists of one syllable, then the stress is on that syllable, for example:
ya
Does the word end in a consonant (not -s or -n)? Then the word stress is on the last syllable, for example:
Madridseñorordenador
If a vowel has an acute accent (acento agudo), then that syllable always has the word stress, for example:
teléfonotambiénCórdobainformaciónMálaga
There are strong vowels (a, e, o) and weak vowels (i, y, u). A weak and strong vowel standing together are considered one vowel which is called a diphtong (diptongo). For example:
hielofuertecuando
The verb preferir isn't the only verb with a diphtong in the conjugation. Many more verbs have a stem change. See the verb categories with diphtong ie and diphtong ue.
If the weak vowel is separated from the strong vowel with an accent the vowel with the accent receives the stress:
VIDEO:vacíodía