Apple Support:

You can capture your whole screen or just part of it. The screenshot is automatically saved to your desktop.