As a student of the Spanish Language, this topic keeps coming up. Forget all the Alt-XXX stuff: Life’s too short!
On Windows, the best way to type accented characters is to change your “keyboard layout” to US-International. See Microsoft’s Guide to Keyboard Layouts. Then you use the single-quote key before your vowel to make your accents: ‘a=á, ‘e=é, ‘i=í, ‘o=ó, ‘u=ú. Then you can use ~n to make ñ.
There is a similar setting for Linux (both KDE and Gnome) under Regional/Languages that makes the keyboard behave the same way.
On a Mac, you use Option-E, then a vowel to make á, é, í, ó, ú. For ñ, you use Option-N, then n.