Hey there
last year i did the exact same thing…my classes for the master and ended and i extended my visa for another year so as to work on my thesis while in spain. I had no problems.
I’m not sure where you are, but in my university, i was given a form detailing all the necessary paperwork i needed to turn in. My university allowed me to turn everything in to them in the Relaciones Internacionales department. They, in turn, contacted the police and presented my papers, the police later got in contact with me, as they had done when i originally applied for my student NIE, and i had to go and give my fingerprints again.
As for the papers you’ll need to turn in, i was required to present pretty much the same type of paper i had when i originally applied for the visa: proof of economic means, medical insurance, letter from your master’s or doctoral program, etc. Like i said, i got the original list from my university.
Try talking to the director of your program or the people at the international relations department or whoever is in charge of international students, they should be able to help you. This type of thing is very common so I’m sure some of your professors or some secretary will know exactly what to tell you.
Let me know if you have any more questions.