diff --git a/app/vmalert/web.go b/app/vmalert/web.go
index 3d91fb6aa7..16855d0513 100644
--- a/app/vmalert/web.go
+++ b/app/vmalert/web.go
@@ -199,7 +199,11 @@ func (rh *requestHandler) groups() []APIGroup {
 
 	// sort list of alerts for deterministic output
 	sort.Slice(groups, func(i, j int) bool {
-		return groups[i].Name < groups[j].Name
+		a, b := groups[i], groups[j]
+		if a.Name != b.Name {
+			return a.Name < b.Name
+		}
+		return a.File < b.File
 	})
 
 	return groups
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 7980325fe3..e7984f67b9 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ The following `tip` changes can be tested by building VictoriaMetrics components
 
 * BUGFIX: fix the misleading error `0ms is out of allowed range [0 ...` when passing `step=0` to [/api/v1/query](https://docs.victoriametrics.com/keyconcepts/#instant-query)
   or [/api/v1/query_range](https://docs.victoriametrics.com/keyconcepts/#range-query). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5795).
+* BUGFIX: [vmalert](https://docs.victoriametrics.com/#vmalert): consistently sort groups by name and filename on `/groups` page in UI. This should prevent non-deterministic sorting for groups with identical names.
 
 ## [v1.93.12](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.12)