You can use a guitar to play anything from death metal to country to classical and everything in between. Learning to play guitar is more approachable than many other instruments, once you master a few basics. It may take you years to get the basics down, and you may need formal instruction at some point to exploit the instrument's full potential.
This is a good article for people who already have their guitar, or are seriously considering buying one, but are struggling to get started and want to teach themselves. For those who have significant difficulty forming chord shapes with their fingers, it may be better to start off learning songs which utilize single notes or power chords. This will help build finger strength, dexterity, and familiarity with the guitar, hopefully with less stress and frustration.
1. Consider buying a tuner.
Tuners make playing sound better, but they will also familiarize you with which string and fret combinations correspond with which notes. They should be available anywhere guitars or guitar music is sold.
2. Learn how to read guitar tabs.
Guitarists have their own system of music notation called guitar tablature, or "guitar tabs" for short. The basic idea is to look at the tab in the same way you look at your guitar; each line corresponds to a string, and each number tells you which fret to hold down when plucking that string.
3. Place your fingers correctly on the frets.
Right-handed players use their left hand for fretting and use their right hand for picking. The frets are the metal strips that run perpendicular to the strings. You actually press your finger down between the metal strips, not on them. For example, if you're playing the third fret, you place your finger on the string between the second and third metal strip. Hold the string down firmly so that it only vibrates between your finger and your strumming hand. Do not forget that you must play on your fingertips and not on the soft part of your finger. This requires cutting your nails to avoid scratching the fretboard. Place your finger as close to the fret as possible to create a good sound.
4. Strum with your other hand.
This can be the most difficult part to learn without having a teacher demonstrate. Strumming consists of downstrokes and upstrokes in various combinations. Count every beat and off-beat as "1 and 2 and 3 and 4 and..." (every "and" is an offbeat). Each beat and offbeat can be an upstroke, downstroke, or no stroke. No matter which direction you use, make an effort to sweep across all of the strings with even pressure and steady speed. You don't want to strum some strings a little harder than others, or start off fast then slow down as you get to the last few strings. The motion should come mostly from the wrist, not the forearm.
5. Practice chords.
A chord is a group of notes that sound good together. The reason they sound good together lies in music theory, but for now, learning how to play a few key chords will suffice. Practice until you can move comfortably between them without losing your rhythm.
6. Learn to play some songs.
Start off with easier songs - ones with fewer chords in simpler arrangements. Listen to the song being played properly with guitar so you know what kind of sound and rhythm to aim for. Start off slow and speed up gradually, singing along (if applicable) to stick with the rhythm. As you master easier songs, move on to more complex pieces. Sweet Home Alabama by Lynyrd Skynyrd is an example of an easier song to start with. It's basically a repetition of the same three chords in the following order: D, C, G, D, C, G, D, C, G.