As a beginner I recommend you to buy a tuner. It does not really matter which brand you buy, they are all good - but I can recommend Yamaha tuners, since I have one myself. It is ridicuolosly easy to tune with a tuner, as long as you have a somewhat good idea of how the strings should sound.
Every string has a particular pitch - a pitch is simply a term used to describe the quality of a note/sound; whether it is brigher or darker. A brighter (or higher) sound has a higher pitch than a darker (or lower) sound.
Listen to the notes below, for instance
The note B is much darker than A, therrefore is has a lower pitch. The opposite goes for A.
If you tune a certain string with a much higher pitch than it should have (that means you tighten the string way too much), the string will break. We don't want that do we?
In order to avoid this you need to know roughly the sound of the strings. It is difficult to know by heart, so you will need a reference that you know is valid/correct.
In the picture on the left you can click either on the strings themselves or the notes to listen to what the strings should sound like with its correct pitch!
Using this information you can try to tighten the strings as you listen to the reference notes.
When you have done this you can use the tuner as a fine adjuster - it will tell you when the string resonates at a precise pitch. But to be sure you are tuning at the right pitch you need to listen to the reference notes, as I already mentioned 2 or 3 times =).
Other ways of getting reference notes is using a tuning fork, tuning pipe or other instruments that are always tuned like a keyboard.
Using tuning programs works just as fine as using a tuner - but then you will need to have a microphone hooked up to your computer. There are free programs that you can download under Tools - Music programs.
Being able to tune your guitar without the use of a tuner is a skill that takes some time to master, however it is very important to know as a guitarist.
If you do not already have a well-developed musical ear (and believe me when I say that it takes some time to get one) - then you simply will not be able to do this in the beginning. There's the fact - without sugarcoating.
But you will be able to do it quite soon if you give it time and practise, like everything else. Most likely you will be able to tune your guitar somewhat, but to get it perfect (or near-perfect) takes longer time. but not to worry - you will be able to do this.
After a couple of years of playing (or shorter time, it's very individual) you might even be able to tune a guitar by remembering how a specific note sounds. A tip is to remember a certain riff in a song where they play a specific note.
When your ear is really well tuned, you can tune your guitar by just playing a chord and tuning for how the chord should sound - but this is a skill that takes even longer time.
Allright, let's start tuning.

The most common way of tuning a guitar is by fretting a lower pitch string to match the proper sound of a higher pitch string.
Sounds messy? It isn't.
If we, for instance, have a tuned lower E-string - this means that all the notes that you play on this string are tuned and correct notes.
On the fifth fret of the tuned lower E-string you have the note A, which has the same pitch and sound as a loose (unfretted) A string should have. By comparing the sound of the fifth fret of the lower E-string you can then tune your A string by turning the tuner until it sounds the same.
Then you can do the same with the rest of the strings until the higher e-string. So all of these strings will be tuned by the initial tuned lower E string.
Exception: the B string is tuned by fretting the fourth fret on the G string instead of the fifth. You can see the fretting pattern in the picture. Now try it out - and then compare with these sounds of the tuned strings:
I want to make sure you understood the above - so here's a video=).
Harmonics is a term used to describe the sounds you can get by plucking a when you gently touch it with the tip of your finger. It is not easy to do in the beginning, I remember how I used to try to do it but it just wouldn't work, hehe.
The key in doing this is to:
a. Hold your finger just above the metal pin, and not in between two pins (as you usually do when you fret)
b. use the clean harmonics positions that are found on the 5th, 7th and 12th frets.
The harmonic on the same fret is the same note you get when you actually fret the string on the 12th fret.
Here are the steps for tuning with harmonics:
It is advisable that you control your tuning with hte previous tuning method, or by just playing a chord and making sure it sounds right.
Note well that this tuning method does not work on all guitars. But it is still good to know - and also it is cool to know how to do the harmonics as an effect=).
I will go through the steps in the video
Now you should have some idea of how to tune your guitar with /without a tuner. There are other ways to tune the guitar, using different reference notes etc, but these are the most common ways.