There are numerous methods to writing a song. I think which ever method you choose depends on personal preferance, and inspiration. I have written the lyrics first, usualy during one of my great college classes, than set the music to it later. You can also start with the melody, the harmony, or the rythem. Remember that a songe= lyrics + melody + harmony + rythem.
Sometimes i'll be jaming on my guitar and find a chord progression or melody that I like so i'll write it down and maybe put it is a song down the road.
Usualy, which every you write first (the music or the lyrics) sets the mood of the song.
1 Peter 2:16