From a reductionist foundational viewpoint, equality in mathematics is equality of sets, as defined by the (ZFC) axioms of set theory. Recall that the axiom of extensionality states that two sets are equal iff they have precisely the same elements. Let's examine how the equality of sets percolates up to equality on other mathematical objects, e.g. number systems, algebraic structures, etc.
The natural numbers $\,\Bbb N\,$ may be represented by sets, e.g. von-Neumann ordinals. Then equality of naturals is the same as set-theoretic equality. The integers $\,\Bbb Z\,$ may be constructed from $\,\Bbb N\,$ by a standard difference semiring construction, where integers are represented by equivalence classes of pairs $\rm\,(j,k)\,$ of naturals modulo the equivalence relation $\rm\,(j,k) \equiv (m,n)\,$ iff $\rm\,j+n = m+k.\:$ The idea is that the equivalence class $\rm\,[(j,k)]\,$ represents the solution $\rm\,x\,$ of $\rm\, x + k = j,\,$ i.e. the integer $\rm\: j-k.\:$ Thus, set-theoretically, integers are certain subsets of $\,\Bbb N^2,\,$ and, hence, integer equality is set-theoretic equality in $\,\Bbb N^2.\,$
Similarly, rationals (fractions) are constructed as pairs of integers, modulo the well-known equivalence relation for fractions, i.e. if a fraction $\rm\,a/b\,$ is represented by the pair $\rm\,(a,b),\,$ then $\rm\, (a,b) \equiv (c,d)\,$ iff $\rm\,ad = bc,\:$ e.g. $\rm\,1/2 = [(1,2)] = \{\ldots,(-2,-4),(-1,-2)(1,2),(2,4),\ldots\}.$ Again, fractions are certain subsets of $\rm\,\Bbb Z^2,\,$ and fraction equality is the same as set-theoretic equality of these sets (equivalence classes). The same holds true for all other numbers systems (e.g. Hamilton's construction of $\,\Bbb C\,$ as pairs of reals). In every case, their equality relations are equivalence relations, so equality boils down to set-theoretic equality of equivalence classes.
Moving up to the structural level, rings are represented by equivalence classes of isomorphic rings, so ring equality is again set-theoretic equality. Similarly for other algebraic structures.
In analogy with programming languages, this is the "assembly language" view of mathematical objects, where everything has been disassembled to its primitive machine-level data-types and operations. When working at a high-level, we don't conceptualize the objects in terms of these primitive representations. But to be rigorous, they must be built up this way from the primitive set-theoretical foundations. And it is set-theoretic equality that percolates up to the higher-level equivalence relations that define equality on these higher-level composite mathematical objects.