diff --git a/ltfatpy/tools/lcm.py b/ltfatpy/tools/lcm.py
index 2618c9c801676299bc809c4a3a565643ddb16e01..93af7f2b86818dc61f0859d4c5f07631ebc87d97 100644
--- a/ltfatpy/tools/lcm.py
+++ b/ltfatpy/tools/lcm.py
@@ -6,8 +6,14 @@
 
 from __future__ import print_function, division
 
-from fractions import gcd
 from math import copysign
+try:
+    from math import gcd
+except ImportError:
+    # fractions.gcd() is deprecated since Python 3.5 and math.gcd() should be
+    # used instead, but for backward compatibilty we use fractions.gcd() if
+    # math.gcd() is not available
+    from fractions import gcd
 
 
 def lcm(X, Y):