The striker, who had not scored for his adopted homeland since defecting from Brazil in February, netted Spain's third goal in a comfortable success on Sunday.
Having lost 2-1 to Slovakia on Thursday, coach Vicente del Bosque named the youngest side of his six-year tenure, including goalkeeper David de Gea stepping in for out-of-form captain Iker Casillas.
But it was one of the older heads that opened the scoring as David Silva put them ahead after 27 minutes at the Stade Josy Barthel.
Paco Alcacer then doubled the lead shortly before half-time with his third goal in as many competitive Spain games before Costa ended his international drought with a scrappy effort.
Juan Bernat capped his international debut with a late strike to add gloss to the scoreline for the much-changed European Championship holders.
The win puts Spain in second in Group C behind leaders Slovakia, who have won three from three so far
Spain unsurprisingly dominated the ball from the off, though Costa was worryingly unable to convert a host of chances that fell his way.
The Chelsea man fired wide in the 18th minute as the visitors toiled in breaking down the five-man Luxembourg defence, though they finally managed it with a moment of individual brilliance.
Silva showed typical composure and poise to bring Chris Philipps's poor clearance under control before lashing a superb half-volley into the top corner from 25 yards.
Costa's search for a first Spain goal continued to be a frustrating one though as he wasted a gilt-edged opportunity on the half-hour mark by skewing woefully wide from eight yards with only goalkeeper Jeremy Joubert to beat.
Alcacer displayed similar profligacy, somehow shooting off-target at the near-post, while De Gea had to remain alert to tip Daniel Da Mota's cross-cum-shot over at the other end.
However, Spain furthered their grip on the game two minutes later as Alcacer atoned for his earlier miss by converting Silva's reverse pass with a fierce shot into Joubert's right-hand corner.
Spain took their foot off the gas in a second half of few opportunities but Costa's moment arrived in the 69th minute.
The former Atletico Madrid man lashed home from point-blank range following a goal-mouth scramble, ending his dry spell at 516 minutes of football with a strike he will hope can kick-start his career for the Iberian nation.
And substitute Bernat took advantage of a weary Luxembourg side to add a fourth in the 88th minute, toe-poking into the bottom corner to add positivity to Del Bosque's apparent new era
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.