Launch Keychain Access and go to Preferences. In the General tab, check the box for “Show keychain status in menu bar.” This will add a padlock icon to your system’s menu bar.
Select this icon and you’ll see several options, the first of which is “Lock Screen.”
The second option is even faster: a keyboard shortcut.
Pressing Control-Shift-Eject on a Mac keyboard will immediately lock your display. If you set your security settings to require a password immediately after sleep, no one will be able to access your Mac without first entering a password.
To change your security settings, go to System Preferences > Security & Privacy > General. Check the box next to “Require password…” and choose the time delay that suits your needs. If you’ll be using your Mac in public places such as coffee shops or libraries, choosing “immediately” will provide the best protection.
[Updated to show that Control-Shift-Eject locks the display instead of sleeping the system.]