Avoiding the fate of giants Argentina and group rivals Germany, who lost 2-1 to Japan earlier on, Luis Enrique’s fancied side sparkled at Doha’s Al Thumama Stadium, dominating possession and taking their chances mercilessly.
Ferran Torres netted twice and Marco Asensio, Dani Olmo, Gavi, Carlos Soler and Alvaro Morata were also on the scoresheet for the Euro 2020 semi-finalists in an emphatic romp.
In the past the 2010 World Cup winners have paid the price for profligacy, but all three forwards Luis Enrique selected netted in the first half to pay back his trust in them.
The coach placed Asensio at false nine, flanked by Olmo and Torres, starting with Morata and Ansu Fati on the bench.
The coach opted to deploy Manchester City midfielder Rodri Hernandez in central defence, alongside club team-mate Aymeric Laporte, correctly anticipating his team would monopolise the ball.
It took only 11 minutes for La Roja to open the scoring, with Gavi stabbing a pass forward for Olmo to receive in the area and the RB Leipzig winger taking one sublime touch to turn and another to stroke the ball gently past Keylor Navas.
Costa Rica, who were a surprise package at the 2014 World Cup, beating Italy and Uruguay and drawing with England to top their group, were sliced apart again for the second goal 10 minutes later.
Jordi Alba’s low drilled cross was rammed home by Real Madrid forward Asensio past his former team-mate Navas, who might have done more to keep it out.
Torres stroked home from the penalty spot after Alba was fouled by Oscar Duarte –- a soft call on a hard night for Los Ticos, who were never in the game and failed to muster a shot at goal.
Barcelona forward Torres capitalised on more slack defending to fire the fourth past Navas early in the second half.
Luis Enrique was able to take off the effervescent Pedri and Torres before the hour mark in order to rest them for Sunday’s clash with Germany, and handed teenage Barcelona left-back Alejandro Balde his debut.
The 19-year-old roared up the pitch in the build-up to Spain’s fifth goal, with substitute Morata crossing for Gavi to drill home with aplomb.
Kopa Trophy winner Gavi became the third youngest goalscorer at a World Cup at 18 years and 110 days old, after Mexico’s Manuel Rosas and record holder Pele.
Soler and Morata then got in on the act with stoppage-time strikes to pile further misery on Costa Rica and help Spain flex their muscles in a perfect opening match in Qatar.