Monosyllabic words have the stress on that one syllable. Example: pais (parents).
If there is an acute accent ('), a circumflex accent (^) over a letter, the stress is on that syllable. Examples: último, útil (useful), país (country), baía (bay), Zêzere (name of a river), avó (grandmother), avô (grandfather).
Else, if the word ends in a letter a, o or e (after first removing any final s, ns or m), the stress falls on the penultimate (one but last) syllable. Examples: falo, falamos, dia, dias, baia, falam, falaram, margem, margens.
All other words bear the stress on the last syllable. Examples: assim, caiu, senti, falei, comer (eat), feliz (happy), propõe (he proposes), manhã (morning), amanhã (tomorrow), falarão (they will speak), cidadão (citizen), cidadãos, coração (heart), corações, alemão (German), alemães.
For the same rules described in a different, more complicated way, and
with many more examples and special cases, see
That description is better suited for the needs of native speakers. They already know which syllables are stressed, because they learnt the language from parents and peers, long before they learnt to read and write. What they want to know is when and where to put accent marks.
My description works the other way round, which makes it more useful for non-native speakers, i.e., foreign learners. They more often first see a word in writing, and want to know how to pronounce it – including which syllable to put the stress on.
Note that the Portuguese words notícia and notícias (message, news) need the accent.
Apart from marking stress, it also turns the last group of letters into a single
syllable: no-tí-cias. Without the accent, the word would have four syllables,
with the last i stressed: *noticias.
Note that there is a difference between Spanish and Portuguese here: in Spanish, the correct pronunciation needs no accent, but the wrong one would. Confer the Spanish names María and Mario, and the corresponding Portuguese names Maria and Mário: same stress pattern in both languages, but different written accents.
To determine the stressed syllable from how a word is written,
it is necessary
to decide what the syllables of the word are. For example, in the word pais
(parents), the ai is supposed to be a single syllable, so the whole word has
only one syllable,
and there is no question where the stress might fall. To get the a and the i
to belong to different syllables, and accent is needed: país (country) has two
syllables, the second of which is stressed.
Confer the name Luís, which does need an accent even though normally a final -is is automatically stressed without a written accent. Apparently without the accent, the name would become monosyllabic, the only syllable being a ui diphthong. Cf. also partiu (left), where iu together make a single, stressed syllable, ciúme (jealousy) and ciumoso (jealous).
Contrary to how it works with "pais" and "país", in a word like raiz (root; plural: raízes) the a and i are supposed to belong to two syllables, even without the accent. The z versus s makes the difference here: words ending in z never have a monosyllabic ai diphthong, so raiz (pronounced ráiz) just can't be a Portuguese word. If it existed, it would be spelled rais.
Other letters having this effect are l, m, n and r if they do not start a next syllable, and also nh. Examples: adail, contribuinte, demiurgo, juiz, paul (marsh, pool, from Vulgar Latin padule), retribuirdes, ruim, rainha ©, tainha, ventoinha, but (because n etc. start a syllable) cafeína, contraí-la, juíza, juízo.
The diphthong ui also doesn't need an accent if it is preceded by a vowel: atraiu, contribuiu, pauis (plural of paul). Cf. pau (stick), one syllable, paul (pool), two syllables, Paulo (man's name), two syllables.
The difference between úi and uí is sometimes relevant for the meaning of words: "fluido" means "fluid" (as a substance), and fluído is the past participle of the verb fluir (stream). Inclui = it includes, incluí = I included.
Next: Accent marks