The reason why a massive star does not immediately collapse to a black hole is radiation pressure.
When a star is in that phase of its life called Main Sequence (MS), its luminosity depends approximately on its mass roughly as $M^4$. This means a star 10 times as massive as the Sun would be 10,000 times more luminous.
This enormous luminosity is mostly produced in the center of the star, where the temperatures are highest, and then convected outwards where the temperatures are lowest. Since radiation pressure depends on temperature as
$$
P = \frac{1}{3} a T^4
$$
there will be very strong pressure gradients which oppose the star gravitational collapse. For massive stars, radiation pressure much exceeds gas pressure, while the reverse occurs in low mass stars like the Sun, because of its low luminosity of course.
The importance of these gradients is such that, for star masses exceeding $\approx 100 M_\odot$, these pressure gradients become so large to blow away the star. In fact, this is exactly the mechanism that limits the mass of the largest stars to below $100 M_\odot$.
The existence of this mechanism is revealed also through another important phenomenon: mass loss through winds. During later stages of the star's life, when it has expanded away from the MS to become a subgiant and then a giant, the outer layers of the star are so loosely bound that radiation pressure is sufficiently powerful to blow them away: mind you, not blow away the whole star, just the outer layers.
These winds from massive stars are awesome: they can exceed speeds of $1000\; km\; s^{-1}$, and can be so massive that a star of $90 M_\odot$ loses 90% of all its mass within its very short lifetime (just a few million years).
When the wind phase ceases, the remaining star is rather more compact, and radiation pressure is now unable to blow away any remaining part. This goes on not until nuclear fuel is exhausted (apparently, a common misconception): the star begins its collapse before nuclear fuel is exhausted.
The reason is that some late nuclear processes produce copious amount of neutrinos which, due to their very small cross-section for interaction with normal matter, are free to escape from the star. Thus, at this point nuclear reactions do not heat the stellar material, they cool it. This hastens of course the stellar collapse. These processes are so destructive they are called URCA processes, from the name of a famous casino in Rio: the implication being that energy (instead of money) is wasted away in the form of neutrinos (rather than into the casino's coffers).
There are other nuclear processes which are quite detrimental to the star equilibrium, like photodissociation of iron nuclei, in this case because they absorb energy rather than liberate it.
Altogether, this means that stellar collapse takes place before nuclear fuel is exhausted.