Welcome to the Wefugees community and thank you for your question.
In cordance with the Dublin III regulation it is indeed possible that Germany deports you back to Spain. That's because Spain issued you a visa. The regulation makes sure that there is only one EU member state that is responsible for the asylum procedure of an asylum seeker.
If German authorities come to the conclusion that Spain is responsible, they ask them to take you back. If Spain gives their consent, you will be sent back. However, that doesn't mean that your asylum application got rejected. Spain is still obliged to give you a procedure and to check the reasons you provided why you need refugee protection.