diff --git a/hspec-discover.cabal b/hspec-discover.cabal
--- a/hspec-discover.cabal
+++ b/hspec-discover.cabal
@@ -1,5 +1,5 @@
 name:             hspec-discover
-version:          2.1.3
+version:          2.1.4
 license:          MIT
 license-file:     LICENSE
 copyright:        (c) 2012-2014 Simon Hengel
diff --git a/src/Run.hs b/src/Run.hs
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -121,12 +121,21 @@
 fileToSpec :: FilePath -> FilePath -> Maybe Spec
 fileToSpec dir file = case reverse $ splitDirectories file of
   x:xs -> case stripSuffix "Spec.hs" x <|> stripSuffix "Spec.lhs" x of
-    Just name | (not . null) name -> Just . Spec (dir </> file) $ (intercalate "." . reverse) (name : xs)
+    Just name | isValidModuleName name && all isValidModuleName xs ->
+      Just . Spec (dir </> file) $ (intercalate "." . reverse) (name : xs)
     _ -> Nothing
   _ -> Nothing
   where
     stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
     stripSuffix suffix str = reverse <$> stripPrefix (reverse suffix) (reverse str)
+
+-- See `Cabal.Distribution.ModuleName` (http://git.io/bj34)
+isValidModuleName :: String -> Bool
+isValidModuleName [] = False
+isValidModuleName (c:cs) = isUpper c && all isValidModuleChar cs
+
+isValidModuleChar :: Char -> Bool
+isValidModuleChar c = isAlphaNum c || c == '_' || c == '\''
 
 getFilesRecursive :: FilePath -> IO [FilePath]
 getFilesRecursive baseDir = sort <$> go []
diff --git a/test/RunSpec.hs b/test/RunSpec.hs
--- a/test/RunSpec.hs
+++ b/test/RunSpec.hs
@@ -84,6 +84,14 @@
     it "returns Nothing for invalid spec name" $ do
       fileToSpec "" "foo" `shouldBe` Nothing
 
+    context "when spec does not have a valid module name" $ do
+      it "returns Nothing" $ do
+        fileToSpec "" "flycheck_Spec.hs" `shouldBe` Nothing
+
+    context "when any component of a hierarchical module name is not valid"$ do
+      it "returns Nothing" $ do
+        fileToSpec "" ("Valid" </> "invalid"  </>"MiddleNamesSpec.hs") `shouldBe` Nothing
+
     context "when path has directory component" $ do
       it "converts path to spec name" $ do
         let file = "Foo" </> "Bar" </> "BazSpec.hs"
