Taking a screenshot of a portion of your screen is much easier with a couple extra steps. This is useful for when you have multiple applications running and want a precise, clean image of the window you want to capture.
Capture a specific window
On your keyboard, press Shift + Command + 4 + Spacebar - afterward you'll notice your cursor change to a camera icon
Click the window you want to capture to screenshot it
If you want to exclude the window's shadow from the screenshot, press and hold the Option key while clicking