El acento escrito 

You have already learned the general rules about how to find out which syllable of a word is stressed and also that whenever a word doesn't follow these general rules you have to put a written accent above the stressed syllable.

This is also the case for diphthongs, the combination of two "weak" or one "weak" and one "strong" vowels. A diphthong constitutes a single syllable. However, if the stress of a word falls on the "weak" vowel of a "strong"-"weak" vowel combination, you must put a written accent above this vowel to make it "strong". By doing this you eliminate the diphthong.
 

Ma-rio (diphthong)  Ma-rí-a (no diphthong) 
el dia-rio (diphthong)  el dí-a (no diphthong)
con-ti-nuo (diphthong)  (el) con-ti-nú-a (no diphthong)
ha-cia (diphthong)  ha-cí-a (no diphthong)

 In other cases the accent has no effect on pronounciation or stress. Here it is only used to differenciate words that have the same fom but different meanings and uses:
 

aquel: that (demonstrative adjective) aquél: that  (adverb)
aun: even (adverb) aún: yet, still (adverb
de: of, from (preposition) dé: subj. of "dar" (verb)
el: the (definite article) él: he (personal pronoun)
ese/a/ os/ as: this (demonstrative adjective) ése/a/os/as: this (demonstrative pronoun)
este/a/os/as: this (demonstrative adjective) éste/a/os/as: this (demonstrative pronoun)
mas but (conjunction) más: more (adverb)
mi: muy (possessive adjective) mí: me (personal pronoun)
se: him/her/itself, themselves (reflexive pronoun) sé: I know (verb)
si: if (conjunction) sí: yes (adverb)
solo: alone (adjective) sólo: only (adverb)
te: you (object pronoun) té: tea (noun)
tu: your (possessive adjective) tú: you (subject pronoun)

 Adverbs that end in -mente keep the written accent of the original adjective:

cortés - cortésmente, rápido -rápidamente
For typographical reasons, the accent on uppercase letters are often omitted:
Los Ángeles or Los Angeles