Stay up to date with the latest news
Subscribe to our telegram channel
The sides failed to score any goal during normal or extra-time and a shoot-out was needed for the first time at these finals.
Full-back Yuichi Komano had hit the cross bar with Japan's third kick, while Oscar Cardozo slotted home his side’s fifth penalty.
Spain qualified to the quarterfinals after a 1-0 win over Portugal. David Villa scored the only goal of the match on the 63rd minute.
The European champions now face Paraguay on 3 July and have a strong chance of reaching only their second World Cup semi-final and the first for 60 years.