Somebody has ended up here, when looking for this on Google:
Can a unmarried South African mother apply for a Spanish passport for her baby if the father is a Spaniard.
The answer is yes. The baby is Spanish. If you are not on friendly terms with the father you may need to request a paternity test. If you are in South Africa, locate a Spanish consulate or the Embassy. Links here. If you are in Spain, go to the nearest Ayuntamiento and request the help of the social services. Good luck.