Copied from: http://www.ultimate-guitar.com/lessons/for_beginners/how_to_know_which_key_a_song_is_in.html
I remember sitting up nights reading a lot of material trying to learn how to read a song, and find out which key a song is in, so that I might easily know which notes to base a solo on. But I haven’t found any good guides that sums it all up, just some guides that seem to include some of the material. This is for beginners, to get a grasp of the subject.
Let’s take a song called Me and Bobby McGee.
The version I play uses the chords G, C and D. Therefore, this song is in G.
Now, why is the song in G?
Well let me tell you how I knew that, because it had G, C and D in it.
Check out this chart:

Now what can we see here?
Well for startes, 1, 4 and 5 are ALWAYS Major chords(G, C, F# etc). 2, 3 and 6 are always minors(Dm, Am, C#m etc) and 7s are diminished chords, even though sometimes used as a major in certain songs.
So, we have Me and Bobby McGee, a song which has a G major, C major and D major chords in it. Look down the chart, which songs have G, C and D major in it? Ah, G has those three chords. Therefore Me and Bobby McGee is in G.
Lets take another nice country song while we’re at it:
Three Wooded Crosses by Randy Travis
The version I know of this song uses these chords: C, Dm, Em, F, G and Am(and also Am7, but yeah).
So, go up the chart and tell me what key this song is in. Scroll down when you are ready.
Yeah, this song is in C.
Now, next song:
Folsom Prison Blues by Johnny Cash
It uses the chords E, B and A. Which key?
Right, its in E (as most of Johnny Songs where).
Now you should have a clearer understanding of which songs are in which key.
Source: ultimate-guitar.com