TOKYO, July 31 (Reuters) - Hosts Japan displayed nerves of steel as they edged out New Zealand 4-2 in a penalty shootout to reach the men's Olympic soccer semi-finals on Saturday, while Spain survived a scare in an extra-time win over Ivory Coast.
After a goalless 120 minutes at the Ibaraki Kashima Stadium, New Zealand full back Liberato Cacace's penalty was saved by Kosei Tani and midfielder Clayton Lewis blasted his spot-kick over the bar.
Captain Maya Yoshida made it four out of four from the spot as Japan booked a place in the Olympic semi-finals for the first time since the London 2012 Games.
Japan are the only team to maintain a perfect record in the group stage and are now just one win away from securing a first medal in men's soccer since claiming bronze at the 1968 Games.
They will next face Spain, who ended their 21-year wait to reach the final four with a 5-2 win over Ivory Coast.
"We would've liked to have scored in the 90 minutes but New Zealand are a good team and really gave us a tough game," Japan coach Hajime Moriyasu told reporters.
"It's going to be a tough game in the semi-finals, but we will stick together as a unit and battle it out to the death and try and reach the final."
Defending champions Brazil never hit top gear but did enough to beat Egypt 1-0, thanks to a first-half strike from youngster Matheus Cunha.
Up next for Brazil are 2012 gold medallists Mexico, who put on an attacking masterclass in a 6-3 rout of South Korea in Yokohama.
Midfielder Sebastian Cordova and forward Henry Martin scored two goals each, while Eduardo Aguirre and Luis Romo also got on the scoresheet as Mexico sounded out a warning to their rivals heading into the business end of the competition.
Spain, the last European side to win a men's soccer gold in 1992, survived a scare against Ivory Coast after Rafa Mir came off the bench to fire a stunning hat-trick in the closing stages at Miyagi Stadium.
Winger Max Gradel appeared to have secured Ivory Coast's place in the final four when he made it 2-1 with a stoppage time strike, only for Mir to score almost immediately at the other end to force extra time.
Ivory Coast's fate was sealed when defender Eric Bailly, who scored their opening goal inside 10 minutes, turned from hero to villain as he conceded a penalty with a bizarre handball inside the box.
Mikel Oyarzabal slotted the ball home from the spot in the 98th minute before Mir added two more goals past an exhausted Ivory Coast defence to put the result beyond doubt.
Victory ensured Spain's first appearance in the semi-finals since claiming silver at the 2000 Sydney Games.
Our Standards: The Thomson Reuters Trust Principles.