We investigate the extent to which the exchange relation holds in finite groups G. We define a new equivalence relation ≡m, where two elements are equivalent if each can be substituted for the other in any generating set for G. We then refine this to a new sequence ≡m(r) of equivalence relations by saying that x≡m(r)y if each can be substituted for the other in any r-element generating set. The relations ≡m(r) become finer as r increases, and we define a new group invariant ψ(G) to be the value of r at which they stabilise to ≡m. Remarkably, we are able to prove that if G is soluble then ψ(G)∈{d(G),d(G)+1}, where d(G) is the minimum number of generators of G, and to classify the finite soluble groups G for which ψ(G)=d(G). For insoluble G, we show that d(G)≤ψ(G)≤d(G)+5. However, we know of no examples of groups G for which ψ(G)>d(G)+1. As an application, we look at the generating graph of G, whose vertices are the elements of G, the edges being the 2-element generating sets. Our relation ≡m(2) enables us to calculate Aut(Γ(G)) for all soluble groups G of nonzero spread, and give detailed structural information about Aut(Γ(G)) in the insoluble case.