On various data sites, they'll have the SpellID in the page URL.
WoWHead: http://www.wowhead.com/spell=
8690
ThottBot: http://thottbot.com/s
8690
ZAM: http://wow.allakhazam.com/db/spell.html?wspell=
8690
In-game macro (only on spells you know)
/run print(GetSpellLink("Fireball","Rank 1"):match("spell:%d+"))
There are various addons that allow you to look up spell IDs.
I personally use one I wrote last year.
SpellList