Vicente del Bosque's side needed just a point to confirm a place in the last four, but they made doubly sure thanks to a fine brace of goals from Jordi Alba and a 62nd-minute header by substitute Fernando Torres.
The world and European champions will now face Italy, who they crushed 4-0 in last year's Euro 2012 final, in the second semi-final in Fortaleza on Thursday, a day after Brazil meet Uruguay in Belo Horizonte.
"It was a difficult match. We had an excellent rival who fought for the ball," said Spain coach Del Bosque.
"In the end we were able to control the ball and break the match, and that was favourable for us. I think both teams should have scored more goals."
On the prospect of facing Italy again, he said: "It is a challenge for us. We want to play the final on the 30th.
"For Italy it'll also be a very important match, because after the final of the European Championship, I guess they'll want revenge."
Nigeria were ultimately left to rue last Thursday's damaging 2-1 defeat by Uruguay, having begun their Confederations Cup campaign with a breezy 6-1 thrashing of Tahiti.
"We played against a better side, a team who've been together for a long time," said Nigeria coach Stephen Keshi.
"It's a learning process for us, it's good. We have to continue from where we stopped tonight, and build on that."
It was the teams' first meeting since Nigeria beat Spain 3-2 in the group phase of the 1998 World Cup, and if the world champions were out for revenge, they were quick to draw first blood at Estadio Castelao.
There were three minutes on the clock when Andres Iniesta sprayed a pass wide to Barcelona team-mate Alba, and the left-back weaved around three challenges before stroking a low shot past Vincent Enyeama.
Nigeria looked set for an afternoon of toil amid stifling humidity inside the stadium, but despite losing Kenneth Omeruo to injury in the 11th minute, they took the fight to Spain.
Brown Ideye and Joseph Akpala spurned half-chances, while Spain goalkeeper Victor Valdes did superbly to tip a snapshot from the recalled Sunday Mba around the post.
Despite several slick interchanges, the African champions' composure repeatedly let them down whenever they penetrated the Spanish area, but Spain were not without blame in that department either.
Roberto Soldado twice shot straight at Enyeama when clean through on goal, while Cesc Fabregas conspired to hit the post from only eight yards after being picked out by Soldado's sweeping low cross.
Ideye should have drawn Nigeria level early in the second half, but although Ahmed Musa's low centre presented him with an open goal at the back post, he miscued and was unable to dispatch a shot.
Spain introduced David Silva and Torres from the bench and within minutes of coming on, the Chelsea striker made it 2-0, flinging himself at Pedro Rodriguez's left-wing cross to score with a glorious flying header.
Having scored four times in the record-breaking 10-0 rout of Tahiti earlier this week, Torres is now the tournament's leading scorer with five goals.
Godfrey Oboabona prevented the former Liverpool man adding a third with a timely block, before substitute Muhammad Gambo spurned another good chance at the other end by slicing wide with only Valdes to beat.
Spain successfully took the sting out of the game thereafter, only for Alba to add the coup de grace in the 88th minute when he sprang the offside trap, rounded Enyeama, and rolled the ball into the net.