There are two ways for gaining superuser (root) access in the terminal:
The safest (and preferred) way for OS X is to use sudo as explained above. Just be sure you're using an administrator account first.
The second way is more likely to be supported on multiple platforms, and that's the switch user command, su.
To use su, you need to have your root account enabled, which you can do from inside NetInfo Manager. Simply type in su at the prompt and enter root's password. This will give you a shell as the superuser.
***NOTE: if you decide to enable the root user, it's generally a good policy to never log into your computer as root (and defiantly never remotely). Rather, log in as your normal admin user and switch to a root shell using sudo or su.