That is called a Critical Capture, and similar to a Critical Hit, it has a 10% Chance of occurring.
Here is the quote:
The probability of a critical capture depends of the number of Pokémon that has previously been caught in the Pokédex. First, compute the value of a (the modified catch rate), as above. Then, whether or not this value is less than 255 (above which the Pokémon is caught regardless of whether or not it is a critical capture), multiply this value by the following:
Species Caught Multiplier
A random number is generated, and if it is less than the modified value, a critical capture occurs.