Barcelona midfielder Pedri admits Spain's players thought they were out of the World Cup.
While Spain were losing against Japan, there was a moment when Costa Rica were leading Germany in the other game before they collapsed.
Pedri said: "We knew we were out. Personally, I tried to encourage colleagues to find that goal that would help us, but we did not succeed."
Spain now face Morocco in the round of 16.
"We have to go with everything, the games are now life or death. The coach will tell us the mistakes we have had and what we have to improve."