After you go to system preferences/keyboard/input sources as suggested by sberman, click on the + button and scroll down to Portuguese and select that. Over at the right you will see the choices Brazilian, Brazilian abnt, Portuguese. You might want to add all three to see which you like best.
The "Brazilian" layout is pretty useless. It is identical to the US layout and the only way to make accents is via the option key shortcuts: option + n, then o gives you õ.
The Brazilian abnt and Portuguese layouts have dead keys for adding accents over at the right edge of the keyboard. But these may not match what is printed on your keys.
You may prefer to stay with the US layout. On that you can get accented letters by just holding down the base letter and selecting what you want from the popup menu that appears. Or you can use the option key shortcuts.
Another option is the layout called US International PC, which has accent deadkeys on ~, ', etc.
Which ever layout you want to use, you must select it in the "flag" menu at the top right of the screen.
To see which key does what for any layout, use the Keyboard Viewer:
http://support.apple.com/kb/PH13746