|Villa embraces Xabi Alonso at the final whistle [GALLO/GETTY]
A goal by striker David Villa earned Spain a 1-0 win over neighbours Portugal and a World Cup quarter-final place after an electric match in
The alert Villa struck the winner after 63 minutes when he fired the ball into the net off the underside of the bar after his first effort was blocked by excellent goalkeeper Eduardo, having been set up by Xavi's clever back-heel in the area.
Portugal right back Ricardo Costa was sent off in the 90th minute for catching Spain defender Joan Capdevila in the face with an elbow as the pair tussled on the edge of the area.
Spain, the European champions, will meet Paraguay, who earlier won a penalty shootout against Japan after a 0-0 draw, in the last eight at Ellis Park on Saturday.
"We felt comfortable but you have to be careful because things can change quickly," said coach Vicente del Bosque.
"We know we're working well, we want to create a bit of history."
Portugal coach Carlos Queiroz added: "Spain were much more effective moving the ball around. We were looking for chances on the counter-attack. We had our chances - we just didn't score.
"We showed ambition and desire to win but it just wasn't possible. We'll have to come back stronger."
Spain had started the Iberian clash stronger, dominating possession in the early moments, with forwards Fernando Torres and Villa forcing Eduardo to palm away three long distance efforts from the left wing in the first seven minutes.
Portugal right back Ricardo Costa composed himself after a torrid start but his side were still unable to keep possession.
The Spanish, however, did not make use of their control, rarely able to send a decent ball into the box.
Portugal's first chance came in the 20th minute. After good play from lively left back Fabio Coentrao, Tiago's drive was punched high by Iker Casillas and the Spain keeper did well to beat the tall Hugo Almeida to the ball as it came down.
Portugal winger Cristiano Ronaldo had been lively, though mostly ineffective, but nearly scored a stunning goal with a fierce, swerving free kick from almost 40 metres that hit a confounded Casillas in the chest and arms and flew to safety.
Portugal almost went ahead five minutes after half time, Almeida winning some space on the left and attempting to feed the incoming Ronaldo, but his cross deflected off Carles Puyol's knee and flew inches wide of the Spanish post.
Torres was not providing the sort of menace expected of him, and he was replaced in the 58th minute by Fernando Llorente, who took only two minutes to create danger, his flying header from a Sergio Ramos cross kept out by Eduardo.
Spain came close once more moments later when Villa sent a curling shot just wide, but the lethal striker was not to be denied and he grabbed his fourth goal of the tournament – to become joint top scorer - with his next effort.
Portugal failed to respond immediately and almost suffered again after 70 minutes when Ramos beat Coentrao and fired a low diagonal shot that was tipped for a corner by Eduardo.