The particular shot you are asking about was done with models.  Although Top Gun had the full cooperation of the U.S. Navy, and many of the shots you see in the movie were authentic, they wouldn't allow a stunt that dangerous for the purposes of a film.  Any stunt that required damage, destruction, or a near crash of a plane was done using a variety of models and filmed by a dedicated special effects team.  Check out the following YouTube video for more detailed information--the flat spin is shown at about 11:30.  The full video is about 17 minutes long and extremely interesting!

http://youtu.be/04TqHE_PDTU