Nasal vowels are sometimes (but not always) marked by a ~ sign, as in irmã (“sister”), coração (“heart”), nações (“nations”). Nasalization can actually change the meaning of a word: pau (not nasal) means “wood”, but pão (the same vowel sound, but nasal) means “bread”.
Although nasals might seem exotic, they’re not unique to Portuguese. While they don’t exist in Spanish, they’re all over the place in French! You usually see them with vowels that come before an n or m, as in bon, en passant or l’indifférent.
It’s the same thing in Portuguese — vowels that come before an n or m are always nasal, even if they aren’t marked by a ~ sign: entre (“between”), entender (“to understand”), implicante, eles compram (“they buy”). In these cases, the n or m sound shouldn’t actually be pronounced, it’s just a signal that the preceeding vowel is nasal. In fact, the Portuguese word bom (“good”) is almost identical to the French bon. You do not actually bring your lips together to form the m in bom, just like you don’t touch your tongue to the roof of your mouth to pronounce the n in bon.
The best way I’ve found to describe how to make the nasal sound is this: Say the English word “bringing” and notice how when you say “ng” your soft palate in the back of your mouth closes off. Once you notice what’s going on you can actually practice opening and closing your soft palate by saying “ng” over and over. When you close the soft palate, it lets the sound resonate in the nasal cavity instead of the mouth. Then practice saying the Portuguese word bom, but imagine that it’s actually pronounced with that “ng” sound at the end, like “bong”. Say the “ng” at the end very lightly, silently even, just enough to close off your soft palate so that the o sound becomes nasal. Again, it should sound similar to the French bon.
Now try another word: compram. Remember that the m at the end of each syllable should not be pronounced, it’s only there to make the sound nasal. Pretend you are actually saying “congprang” to get a nice nasal a at the end. Saying it this way also keeps you from closing your lips to pronounce the m‘s, which, remember, are always silent when they occur at the end of a syllable. It should sound quite similar to the French je comprende, except that the stress is on the first syllable: COMpram.
When you nasalize vowels, they change their vowel quality a little bit. The one that does this the most, to my ear, is nasal [a]. It changes from a pure open Spanish/Italian aah to more of a closed nasal uhh sound. The best example of this is Copacabana.