There are several different methods that can be used to tune your guitar. The most basic is called relative tuning. With this method, your guitar will sound good when you play even though it might not be tuned exactly to pitch, but it will sound in tune with itself.
First, tune your 6th string (the thickest string that sounds the lowest) to a standard pitch. Try to match your string to the note you are hearing. To raise the pitch of a string, turn the tuning pegs that face up counter-clockwise and the tuning pegs facing down clockwise and reverse the direction to lower the pitch. Turn the tuning pegs only when the note is ringing to have a feedback on how far to turn.
Once you have your 6th string in tune, you can tune the rest of the strings from there. Play the note on the 6th string, 5th fret, then try and tune the 5th string until it matches that pitch (A). Use the same method to tune the rest of the strings. The only string that is different is the 3rd string, where you are going to play the 4th fret instead of the 5th to tune the 2nd string.
Tuning by ear takes some practice, so a good option for tuning your guitar is to buy an electronic tuner. In the last years the price of electronic tuners has dropped drastically, you can buy a decent electronic tuner for under $25.
Electronic guitar tuners come in two varieties: the first one (the standard tuner) allows you to tune the six strings of the guitar to standard pitch and the other more expensive models are chromatic tuners, allowing you to tune to any note, not just those in standard tuning.
A standard guitar tuner is only good as a fine tuning tool, and unless you can tune by ear enough to get you within a 1/2 step, it is useless. With chromatic tuners you do not need to be within a fret distance of the correct pitch, just somewhere in the area of the right octave. If, for instance, you were tuning your 5th string (A) and it was tuned to a B, you can see that it was it was a B and know to tune it down. Chromatic tuners are also easier to use even if you are just tuning to the standard pitch. Songs are often tuned down a 1/2 step and there are also many alternate tunings in use, therefore the chromatic tuner is the way to go, if you ever decide to buy one.