Germany made it two wins at the Women's World Cup.
Bayern Munich midfielder Sara Daebritz's scrappy first-half goal scored the contest and put the side ranked number two in the world all through the knockout stages.
Spain dominated possession but the Germans scored against the run of play when Daebritz pounced on some hesitant defending to the ball at the far post.
16 If South Africa fails to beat China on Thursday, while realistically they look set to top the group.
Two-time winners Germany – who opened with a win over China – have reached the quarter finals in all seven previous World Cups, while the Spaniards – who beat South Africa 3-1 on Saturday – have qualified for the tournament for the second time.
Efficient and resolute, the Germans will remain unbeaten in 14 games since March 2018, while they are still to loose after Spain after five meetings.
Dzsenifer Marozsan, who may miss the rest of the tournament after breaking a win in China, but still possessed the talent and resolve to emerge with the victory.
Jorge Vilda's side had the first half, which started amid torrential, wet conditions in Valenciennes, but Real Sociedad's Nahikari Garcia scored a long run and Atletico Madrid's Silvia Meseguer fired from the edge of the box after a neat move.
Sandra Panos, Spain skipper Marta Torrejon took to the ball, and Daebritz pounced to slide the ball in on the rebound.
After the break, Torrejon's free-kick hit the wall from one of Spain's best chances, before substitute Klara Buehl blazed over at the other end for Germany, and they were solid at the back to make a comeback.
'A question of will-power'
Germany boss Martina Voss-Tecklenburg: "It's a difficult group. The first two matches were difficult and now we have six points.
"Maybe for other teams in other groups it was easier for them, but it was more complicated for us.
Now we can build on that. "" We know we have to improve some things but we are very happy to have six points. "
Goal scorer Sara Daebritz: Everybody gave 100%, right from the beginning.
The Spanish players were very good with the ball.
We have six points after two matches and that's what our goal.
"Now we can show in the third match how well we play football."
Spain boss Jorge Vilda: A lot of the time, specifically in the first half, we played good football.
"Mistakes cost us against this good side." They were the second best team in the world and we were able to dominate them.
"We were not able to put the cherry on top of the cake with a goal and we were penalized on one error.
"We just need to focus on the China match now."
Germany continues superb group-stage record stats
- Germany are unbeaten in their last 18 Women's World Cup Group Stage games, the longest run in the history of competition (W14 D4).
- Spain has only their second defeat in their last eight games in all competitions (W4 D2).
- World Cup matches against European opposition (W6 D4), losing their last match against England in the 2015 edition.
- Despite patterning 16 shots in the game, Spain only directed two on target, with the last of them coming in the 47th minute of the contest.
- Germany's Sara Dabritz has posted three goals in her five Women's World Cup Group stage appearances, with those coming from a total of five shots on target.
What next Group B?
Group B's other teams South Africa and China will not play their second match until Thursday (20:00 BST) in Paris.
Then Spain face China in Le Havre on Monday (17:00) at the same time as Germany's final group game against South Africa in Montpellier.
The top two teams wants to qualify automatically for the last 16, while the four best third-placed sides from the tournament's six groups will join them.