Historically stout was a sub-style of Porter, but in 2009 they have become two separate families. The BJCP has done a pretty good job up breaking them up into a lot of separate styles, which is really the best way to look at it because there is quite a bit of difference when you get down to the nitty gritty of very specific individual styles. If you try to just say "what is the difference between 'stout' and 'porter' as major categories" there is a ton of overlap and about the only thing I could say is definite in my opinion would be roast barely.
The guys at Geek Beer wrote several blog postings on the subject, complete with graphs charting the crossover of porters, stouts, Russian Imperial stouts, etc.
Check it out, if you've got a little while to read.
Bjcp is a great place to start. At some point it becomes subjective. So, for my beers it's simple. If I hold the beer up to a light and it shows a red hue, it's a porter. If it's just black, it's a stout. Both look black away from the light however.
__________________
(~):} Just a little Furthur (~):}
Guinness used to be called 'Guinness extra stout porter'. As some one mentioned, stout is an adjective and it was used to describe a porter, but as beer brands, names, and styles evolved, the term stout became a noun of its own and in some cases the defining characterics were blurred. Its kind of like when speaking of hoppy pale ales, you wonder, is this an IPA?
Generally speaking though when comparing all porters vs all stouts, porters are less dark and have more malty smooth character, while stouts are a little darker and more bitter.
The key element is roasted barley. Yes some porters call for roasted barley, but will usually be like 1% - 3% and stouts usually have more like 5% - 10% or more roasted barley.