diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index cad7293a0b02dd753aecec06c50f7df8bf4f67e6..af985683d3f2bb0ddc5cf97f715d170bd4cbefd3 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -5732,7 +5732,9 @@ class IfStatNode(StatNode):
     def generate_execution_code(self, code):
         code.mark_pos(self.pos)
         end_label = code.new_label()
-        last = len(self.if_clauses) - 1
+        last = len(self.if_clauses)
+        if not self.else_clause:
+            last -= 1  # avoid redundant goto at end of last if-clause
         for i, if_clause in enumerate(self.if_clauses):
             if_clause.generate_execution_code(code, end_label, is_last=i == last)
         if self.else_clause: