If you initialise a variable within a function, including setup(), then it will only be valid within that function
That's misleading - you're confusing definition with initialisation.
The scope of the variable is determined by where it is defined. It can be initialised at the same time, or by code that runs subsequently. The code can be anywhere that has visibility of the variable.
In the specific example given the variable actually represents a constant and should be defined like this:
const int led = 13;
(It would be better if a more meaningful the name was used.)
In the more general case where you are defining a global variable you can reasonably initialise it at the point of defining it, or separately in code. My preference is to do it within the declaration since that makes the code easier to maintain, and also establishes a good habit for the initialisation of automatic (local) variables.