Sergio Busquets denied suggestions Spain were relieved to have avoided a potential World Cup quarter-final against Brazil after La Roja survived an almighty scare to advance from Group E.

Spain were on course to top the group when Alvaro Morata gave them an early lead against Japan at the Khalifa International Stadium on Thursday, but Ao Tanaka followed up Ritsu Doan's leveller within 142 seconds to fire the Samurai Blue to first place.

Spain's defeat saw them advance via goal difference as Germany beat Costa Rica 4-2 in the group's other game, and La Roja were briefly set for a stunning group-stage exit when Los Ticos led Hansi Flick's team with 20 minutes remaining.

Spain will now meet Morocco in the last 16, and provided Brazil avoid defeat to Cameroon on Friday, they will not be able to meet the pre-tournament favourites until the final.

However, Busquets was dismissive when asked if that represented a positive outcome, saying: "It has nothing to do with it.

"We wanted to win and be first. We go to the other side of the bracket, but that does not guarantee that it will be easier or more difficult.

"We didn't want this to happen, our intention was to win. To continue, we have the round of 16 against Morocco, which is going to be a very difficult match.

"We were not comfortable. They closed the pass between the lines very well and it was very difficult for us to connect and create danger.

"We knew it was going to be like that, it's a shame about the goals. We have to continue, try to correct the mistakes, and go through the knockouts."

Spain dropped to third place when Manuel Neuer's own goal put Costa Rica 2-1 up against Germany at Al Bayt Stadium, before the four-time winners levelled the scores through Kai Havertz three minutes later.

Busquets' midfield partner Pedri revealed Spain were made aware of their perilous situation during that brief period, as he emphasised the need to improve against Morocco.

"We knew we were out. Personally, I tried to encourage my team-mates to look for that goal after they scored against us, but we didn't manage it," Pedri said.

"We have to go with everything, the games now are life or death. The coach will tell us the failures we had and what we have to improve on."

Spain have lost their final group game at a World Cup for the first time since 1982 (1-0 v Northern Ireland), having won eight of their nine previous such matches (D1).

Japan, meanwhile, have reached the last 16 at consecutive World Cups for the first time, topping their group for the first time since they did so on home soil at the 2002 tournament.