People are able to make stylistic distinctions between samples of music quickly and easily. Reliably duplicating this ability with computers has proven to be difficult, but a simple system with modest accuracy can still be useful for some music organization applications.
I have created software to extract certain features from recorded music, and trained and tested three classifiers (Generalized Linear Model, Multilayer Perceptron, and k-Nearest Neighbor) each on three tasks of genre classification using a large collection of labelled examples.
There was little variance in performance among the three classifiers. On average the classifiers correctly classified 77% of the test data in a task involving two highly similar genres, 82% in a task with three highly dissimilar genres, and 64% in a task with seven genres of mixed similarity.
For more information on this topic, see my list of music audio analysis resources.