Previously published authors don't have to sweat this rule much. However, first-time authors should always follow the genre guidelines.
Some Genre Guidelines
Literary/Commercial/Women's: 80,000 to 110,000
-Literary can run as high as 120,000
-Chic Lit: 80,000 to 100,000
Crime Fiction: 90,000 to 100,000
Mysteries/Thrillers/Suspense: 70,000 to 90,000
-Cozy Mysteries: 65,000 to 90,000
Romance: 40,000 to 100,000
-Category Romance: 55,000 to 75,00
Fantasy: 90,000 to 100,000 (some will accept 120,000, but don't aim for it. More doesn't equal better)
Paranormal: 75,000 to 95,000
Horror: 80,000 to 100,000
Science Fiction: 90,000 to 125,000 (big exception due to descriptions and world building)
Historical: 100,000 to 120,000
New Adult Fiction: 60,000 to 85,000
Middle Grade: 25,0000 to 40,000 (debut averages 35,000)
-Upper Middle Grade: 20,000 to 55,000
Picture Books: 500 to 700
Novella: 20,000 to 50,000 (Most agents and editors don't ever want to see a novella)
Non-Fiction: 70,000 to 110,000
Short Stories: 1,000 to 8,000
Flash Fiction: 100 to 500
Western: 80,000 to 100,000 (Almost no editor is buying Westerns these days)
Young Adult Fiction: 50,000 to 80,000 - YA fiction is one of the hardest genres for writers concerning word count due to all of the sub-genres within it. It's a category where the word count is very flexible. However, 55,000 to 70,0000 is a great range. For mainstream YA it's always best to stay under 80,000 words.
-YA contemporary tends to be shorter at 60,000 to 70,000
-YA Fantasy, Science Fiction, and Paranormal tend to run longer due to world building at 70,000 to 90,000 words.
Science Fiction and Fantasy is another hard genre for writers. Some agents and editors will accept a manuscript over 120,000 words but it has to be extraordinary, and you will still be expected to cut it down.
Before you submit your work to an agent be sure to edit, revise and polish, and then ... edit, revise and polish! Make sure you've done your very best work and research each agency. Some include word count preferences right on their site. Study the guidelines carefully, and submit your work accordingly.
Be The Rule. Not The Exception.