"We tried in an orthodox way and in an heroic way but we were not able to score. It wasn't our day. We dominated almost all the match," Vicente del Bosque, Spain's coach, said.
"This defeat means that we have to win the other two [group] matches," he added.
Spain had started the match with just David Villa up front, but brought on Fernando Torres and Jesus Nevas after going behind.
But chances falling to Nevas and then Pique were not taken.
Spain's nerves were put further to the test when Derdiyok tricked his way through the defence to create an opening but could only strike the post with his shot.
Switzerland now share top-spot in Group H with Chile, who earlier beat Honduras 1-0.
Chile's first World Cup victory in 48 years came in Nelspruit after Jean Beausjour tapped in a cross from defender Mauricio Isla on 34 minutes.
The South Americans could have added more goals but missed chances in the second half, including forward Alexis Sanchez putting the ball wide when clean through.
However, the team was satisfied with their victory, with Sanchez saying: "We're very happy, and we have to enjoy this triumph.
"But we have to move ahead and win the game against our next rival."
Chile will play Switzerland and Spain face Honduras in the next Group H matches on June 21.