(CNN) -- David Villa was Spain's hero yet again as his goal helped them past Portugal and into the last eight of the World Cup with a 1-0 second-round victory in Cape Town.
The Barcelona striker registered his fourth goal of the competition just after the hour as he stabbed a shot past Portugal goalkeeper Eduardo, putting him level with Argentina's Gonzalo Higuain and Slovakia striker Robert Vittek as the South African tournament's top scorers.
It was just reward for Spain's endeavor against a largely defensive Portugal team, who struggled to get Cristiano Ronaldo into a game between the neighboring European nations.
Villa's strike should have been added to but Euro 2008 winners Spain squandered a clutch of clear-cut chances.
Vicente Del Bosque's side will now face Paraguay in the quarterfinals on Saturday, after the South American side beat Japan on penalties in Pretoria earlier on Tuesday.
Liverpool striker Fernando Torres nearly opened his account at the World Cup inside the first minute as he forced Portugal keeper Eduardo into a smart save.
Torres' strike partner Villa was the next to test the keeper, who beat away his low shot. Just four minutes later Villa's near-post effort tested Eduardo again.
Portugal's first opportunity came in the 20th minute as Spain keeper Iker Casillas parried Tiago's shot into the air before punching clear when striker Hugo Almeida tried to turn the ball home.
Ronaldo tested Casillas with a free-kick from distance and the keeper spilled his powerful shot, before Almeida should have scored when he rose to meet Fabio Coentrao's cross from the left.
Five minutes after the break, Almeida burst down the left and his cross took a deflection off Carles Puyol and looped just past the post with Casillas beaten.
Torres was taken off for Fernando Llorente just before the hour mark and the Athletic Bilbao striker almost scored with his first touch, but his header from point-blank range was saved by Eduardo.
In the 63rd minute Spain made the breakthrough, with a goal made in Barcelona. Andres Iniesta found Xavi, whose flick found the Spanish champions' new signing Villa -- and though his first shot was saved, he tucked the rebound home off the underside of the bar.
Real Madrid defender Sergio Ramos nearly made it 2-0 soon after but his low shot was brilliantly turned behind by Eduardo.
Danny had half a chance to equalize as the ball broke in the area, but Joan Capdevila made a superb block.
Seconds later Ricardo Costa was sent off for an apparent elbow on Capdevila, and the red card signaled the end of Portugal's World Cup hopes.